I am trying to use 'C' with FORTRAN , but first I need to learn some 'C' basics:
In the following code everything works fine except the call to print_c_data, i.e., and don't have any output to the pointer name. Can anyone explain me why?
code:
#include <stdio.h>
#include <string.h>
void print_c_data(int w, int *s, char *name)
{
printf("x=%d\n and y=%d\n and the name is %s\n",w,*s);
}
main()
{
FILE *fp;
int x, *y,z;
char str [] = "Peter",*c;
z=4;
y=&z;
printf("z = %d\n",*y);
x=10;
*y=x;
printf("x value is x e %d\n\n",*y);
c=str;
print_c_data(5,y,c);
printf(" Variable pointer value is %s\n",c);
puts(c);
}
output: z = 4 x value is x e 10 x=5 and y=10 and the name is Variable pointer value is Peter Peter