Write a C program and define a function that takes the length of your name as an input parameter and then allocates memory dynamically to store your name.

#include<stdio.h> #includeint main(){int *n; n = (char*) malloc (20 * sizeof(char) );pritf(“Enter your name”);gets(n); pritf(“Your name is”);while(n!=’0′); printf(“%c”,n++); return 0;} Are you looking for the Class 10 Computer Science SEBA Solution? You are in the right place! This guide provides accurate, well-structured, and easy-to-understand solutions to all topics covered in the SEBA Class 10 Computer…

Write a C program to dynamically allocate memory for an array to store runs scored by Virat Kohli and write a function to find the maximum one.

#include<stdio.h> #includeint main(){int *n,x,large=0; n = (int*) malloc (10 * sizeof(int) );pritf(“Enter the runs scored by Virat Kohli in the last ten ODI cricket matches”);for( int i=0; i<10; i++ ){scanf(“%d”,(n + i) );} for( int i=0; i<10; i++ ){for( int j=i+; i<10; j++ ){if((n+i)>(n+j)){x=*(n+i);*(n+i)=*(n+j);*(n+j)=temp;}}}pritf(“Maximum runs scored by Virat Kohli is %d”,*(n+9));return 0;} Are you looking…

Write a C program to dynamically allocate memory for an array to store 10 integers and display the first 5 out of them.

#include<stdio.h> #includeint main(){int *n; n = (int*) malloc (10 * sizeof(int) );pritf(“Enter the Number”);for( int i=0; i<10; i++ ){scanf(“%d”,(n + i) );}printf(“Your 1st 5 number are”)for( int i=0; i<5; i++ ){printf( “%d\n”,*(n + i) );}return 0;} Are you looking for the Class 10 Computer Science SEBA Solution? You are in the right place! This guide…

Write the output of the following code segment.(f)

char *ptr, x = ‘A’; ptr = &x; char y = ++(*ptr); printf(“\n %c”, y); Output:B Reasoning x is initialized to ‘A’ (ASCII 65) 🏷️ ptr stores the address of x → ptr = &x 🏷️ Expression ++(ptr): printf(“\n %c”, y); prints y, which is ‘B’ Final Output:B (because pre-increment updates x before assignment). Are…

Write the output of the following code segment.(e)

char *ptr, x = ‘A’; ptr = &x; char y = (*ptr)++; printf(“\n %c”, y); Output:A Reasoning x is initialized to ‘A’ (ASCII 65) ptr stores the address of x → ptr = &x Expression (ptr)++: printf(“\n %c”, y); prints y, which is ‘A’ Final Output:A (because post-increment returns the original value first).But x is…

Write the output of the following code segment.(b)

int *ptr, x = 9; ptr = &x; printf(“\n %d”, (*ptr)++); printf(“\n %d”, *ptr); Output:910 Reason:- x is initialized to 9 → x = 9 ptr stores the address of x → ptr = &x First printf(“\n %d”, (ptr)++); Second printf(“\n %d”, ptr); Final Output:9 (before increment)10 (after increment) Are you looking for the Class…

Write the output of the following code segment.(a)

int *ptr, x = 9; ptr = &x; printf(“\n %d”, (*ptr)++); Output:9 Reason:-In the above program. x is initialized to 9 ptr stores the address of x (*ptr)++ means:*ptr (value at address ptr) is 9 Final Output:9 (because post-increment prints the original value first). Are you looking for the Class 10 Computer Science SEBA Solution?…