how to delete an element in an array
Answers were Sorted based on User's Feedback
Answer / aneesh sagar
void main()
{
int a[10],i,j,pos;
printf("enter the element in the array:\n");
for(i=0;i<10;i++)
scanf("%d",&a[i]);
printf("enter the position to be deleted\n");
scanf("%d",&pos);
i=0;
while(i!=pos-1)
i++;
for(j=i;j>10;j++)
a[j]=a[i+1];
i++;
printf("now the array is");
for(i=0;i<10;i++)
printf("%d",a[i]);
| Is This Answer Correct ? | 1 Yes | 0 No |
Answer / jessybhatia
void main()
{
int a[50],i,pos,size;
clrscr();
printf("\nEnter size of the array: ");
scanf("%d",&size);
printf("\nEnter %d elements in to the array: ",size);
for(i=0;i
scanf("%d",&a[i]);
printf("\nEnter position where to delete: ");
scanf("%d",&pos);
i=0;
while(i!=pos-1)
i++;
while(i<10)
{
a[i]=a[i+1];
i++;
}
| Is This Answer Correct ? | 8 Yes | 20 No |
what will be the position of the file marker? a: fseek(ptr,0,SEEK_SET); b: fseek(ptr,0,SEEK_CUR);
which function is used to clear the buffer stream on gcc? for example: I wrote following code on gcc #include<stdio.h> int main(void) { char ch; int a,b; printf("\nenter two numbers:\t"); scanf("%d%d",&a,&b); printf("enter number is %d and %d",a,b); printf("\nentercharacter:\t"); scanf("%c",&ch); printf("enter character is %c",ch); return 0; } in above progarm ch could not be scan. why?plz tell me solution.
typedef struct error{int warning, error, exception;}error; main() { error g1; g1.error =1; printf("%d",g1.error); }
There are 21 people in a room. They have to form groups of 3 people each. How many combinations are possible? Write a C program to print the same.
main ( ) { static char *s[ ] = {“black”, “white”, “yellow”, “violet”}; char **ptr[ ] = {s+3, s+2, s+1, s}, ***p; p = ptr; **++p; printf(“%s”,*--*++p + 3); }
What is full form of PEPSI
void main() { if(~0 == (unsigned int)-1) printf(“You can answer this if you know how values are represented in memory”); }
main() { int a[10]; printf("%d",*a+1-*a+3); }
main() { int i=5; printf("%d",++i++); }
Under linux environment can u please provide a c code for computing sum of series 1-2+3-4+5......n terms and -1+2-3+4-5...n terms..
String copy logic in one line.
void main() { int i; char a[]="\0"; if(printf("%s\n",a)) printf("Ok here \n"); else printf("Forget it\n"); }