can we define a function in structure?

Answer Posted / sandeep

We Can't define function inside the structure

Is This Answer Correct ?    4 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

main() { struct s1 { char *str; struct s1 *ptr; }; static struct s1 arr[] = { {"Hyderabad",arr+1}, {"Bangalore",arr+2}, {"Delhi",arr} }; struct s1 *p[3]; int i; < BR> for(i=0;i<=2;i++) p[i] = arr[i].ptr; printf("%s ",(*p)->str); printf("%s ",(++*p)->str); printf("%s ",((*p)++)->str); }

921


what is a NULL Pointer? Whether it is same as an uninitialized pointer?

759


if (i = 0)printf ("True"); elseprintf("False"); Under what conditions will the above print out the string "True" a) Never b) Always c) When the value of i is 0 d) all of the above

714


What is the purpose of scanf() and printf() functions?

725


What is the purpose of void pointer?

600






What is the significance of scope resolution operator?

864


Why can't I perform arithmetic on a void* pointer?

639


What are pointers?

635


What is the difference between exit() and _exit() function?

607


How can you tell whether two strings are the same?

835


How can I copy just a portion of a string?

818


Write a program to reverse a linked list in c.

648


What is the concatenation operator?

614


What is the scope of static variable in c?

537


What are multibyte characters?

645