Tuesday, 27 August 2013

passing string pointer to functions

#include<stdio.h>
#include<conio.h>

void func(char *);

int main()
{
    char s[]="rajashekar";
   
    printf("before modifing=%s",s);
   
    func(s);
   
    printf("\nafter modification=%s",s);
   
    getch();
    return 0;
}


void func(char *s)
{
     printf("\ninsidefunction=%s",s);
     *(s+2)='z';
     }

No comments:

Post a Comment