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 |
C program to print magic square of order n where n > 3 and n is odd
How to use power function under linux environment.eg : for(i=1;i<=n;i++){ pow(-1,i-1)} since it alerts undefined reference to 'pow'.
main() { clrscr(); } clrscr();
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.
void main () { int x = 10; printf ("x = %d, y = %d", x,--x++); } a. 10, 10 b. 10, 9 c. 10, 11 d. none of the above
how can i cast a char type array to an int type array
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
How we print the table of 3 using for loop in c programing?
Printf can be implemented by using __________ list.
typedef struct error{int warning, error, exception;}error; main() { error g1; g1.error =1; printf("%d",g1.error); }
Find the largest number in a binary tree
Write a C program to add two numbers before the main function is called.