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 |
main() { show(); } void show() { printf("I'm the greatest"); }
main() { int i=10,j=20; j = i, j?(i,j)?i:j:j; printf("%d %d",i,j); }
posted by surbhi just now main() { float a = 5.375; char *p; int i; p=(char*)&a; for(i=0;i<=3;i++) printf("%02x",(unsigned char) p[i]); } how is the output of this program is :: 0000ac40 please let me know y this output has come
main() { int a[10]; printf("%d",*a+1-*a+3); }
How will you print % character? a. printf(“\%”) b. printf(“\\%”) c. printf(“%%”) d. printf(“\%%”)
main() { int i; float *pf; pf = (float *)&i; *pf = 100.00; printf("\n %d", i); } a. Runtime error. b. 100 c. Some Integer not 100 d. None of the above
void main() { char far *farther,*farthest; printf("%d..%d",sizeof(farther),sizeof(farthest)); }
main() { float f=5,g=10; enum{i=10,j=20,k=50}; printf("%d\n",++k); printf("%f\n",f<<2); printf("%lf\n",f%g); printf("%lf\n",fmod(f,g)); }
Write a program to check whether the number is prime and also check if it there i n fibonacci series, then return true otherwise return false
void main() { int i=5; printf("%d",i++ + ++i); }
void main() { printf(“sizeof (void *) = %d \n“, sizeof( void *)); printf(“sizeof (int *) = %d \n”, sizeof(int *)); printf(“sizeof (double *) = %d \n”, sizeof(double *)); printf(“sizeof(struct unknown *) = %d \n”, sizeof(struct unknown *)); }
How to access command-line arguments?