User Profile
Collapse
-
isn't possible to use a simple scanf? :-) -
separator in scanf
How can I let a scanf recognize some separators?
For example:
user input a stream via scanf:
Giacomo Marciani,male,2 7/06/1990
The program should recognize "," and "/" as separators, and assign Giacomo to a char*, Marciani to another char*,male to another char*,27 to a int,06 to another int and 1990 to another int. -
giacomomarciani started a topic format ‘%X’ expects argument of type ‘unsigned int’, but argument 3 has type 'int *'in Cformat ‘%X’ expects argument of type ‘unsigned int’, but argument 3 has type 'int *'
I don't understand why the piece of code below returns me the error:
warning: format ‘%X’ expects argument of type ‘unsigned int’, but argument 3 has type ‘int *’ [-Wformat]
Code:int *v=malloc(10*sizeof(int)); int i; for(i=0;i<10;i++) v[i]=i; for(i=0;i<10;i++) printf("v[i]=%+2d &v[i]=%#.10X | * (v+i)=%+2d (v+i)=%#.10X\n",v[i],&v[i],*(v+i),(v+i));
No activity results to display
Show More
Leave a comment: