How can you relate the function with the structure? Explain
with an appropriate example.
Answer / Minakshi Rani
In programming, a function is a set of instructions that performs specific tasks. The structure, on the other hand, is a blueprint for creating functions and variables. They are related as functions are defined within structures, which determine their properties such as data type, scope, and behavior. For example, in C language, a struct may define a Person with properties like Name, Age, and Address. A function can be created to display these properties of a Person. Structure: n`nstruct Person {n char Name[50];n int Age;n char Address[100];n};n`nFunction: n`nvoid DisplayPerson(struct Person p) {n printf("Name: %s", p.Name);n printf(" Age: %d", p.Age);n printf(" Address: %s", p.Address);n}n`n
| Is This Answer Correct ? | 0 Yes | 0 No |
writte a c-programm to display smill paces
Write a routine to draw a circle (x ** 2 + y ** 2 = r ** 2) without making use of any floating point computations at all.
2 Answers Mentor Graphics, Microsoft,
void ( * abc( int, void ( *def) () ) ) ();
Cau u say the output....?
main() { int i=300; char *ptr = &i; *++ptr=2; printf("%d",i); }
How can u say that a given point is in a triangle? 1. with the co-ordinates of the 3 vertices specified. 2. with only the co-ordinates of the top vertex given.
main() { int i; printf("%d",scanf("%d",&i)); // value 10 is given as input here }
main() { int c[ ]={2.8,3.4,4,6.7,5}; int j,*p=c,*q=c; for(j=0;j<5;j++) { printf(" %d ",*c); ++q; } for(j=0;j<5;j++){ printf(" %d ",*p); ++p; } }
could you please send the program code for multiplying sparse matrix in c????
Write a Program in 'C' To Insert a Unique Number Only. (Hint: Just Like a Primary Key Numbers In Database.) Please Some One Suggest Me a Better Solution for This question ??
int swap(int *a,int *b) { *a=*a+*b;*b=*a-*b;*a=*a-*b; } main() { int x=10,y=20; swap(&x,&y); printf("x= %d y = %d\n",x,y); }
main() { char p[ ]="%d\n"; p[1] = 'c'; printf(p,65); }