> Finally if you noticed, I had to use & even in printf statements because of the structure of pointers that I used.
Which basically means you got something else wrong as well.
So rather than fix the original mistake, you make a mess of it somewhere else, where there is less error checking.
Sooner or later, printf/scanf format abuse will catch up to you, and it can be hard to track down exactly what the problem is.
Get a better compiler, or wind up the diagnostics if you're using gcc.
This is what I get with your code.
Code:
$ gcc -W -Wall -ansi -pedantic -O2 foo.c
foo.c: In function ‘main’:
foo.c:30: warning: format ‘%s’ expects type ‘char *’, but argument 2 has type ‘char (*)[99u]’
foo.c:32: warning: format ‘%s’ expects type ‘char *’, but argument 2 has type ‘char (*)[99u]’
foo.c:34: warning: format ‘%s’ expects type ‘char *’, but argument 2 has type ‘char (*)[99u]’
foo.c:47: warning: format ‘%10s’ expects type ‘char *’, but argument 2 has type ‘char (*)[99u]’
foo.c:47: warning: format ‘%4s’ expects type ‘char *’, but argument 3 has type ‘char (*)[99u]’
foo.c:47: warning: format ‘%7s’ expects type ‘char *’, but argument 4 has type ‘char (*)[99u]’
foo.c:53: warning: format ‘%s’ expects type ‘char *’, but argument 2 has type ‘char (*)[99u]’
foo.c:54: warning: format ‘%d’ expects type ‘int *’, but argument 2 has type ‘char *’
foo.c:6: warning: unused variable ‘k’
foo.c:8: warning: ‘sname’ may be used uninitialized in this function
foo.c:8: warning: ‘name’ may be used uninitialized in this function
foo.c:8: warning: ‘id’ may be used uninitialized in this function