answersLogoWhite

0


Best Answer

The name of the array means the address of the first element, so 'arr==&arr[0]'

User Avatar

Wiki User

11y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Why and is not required for an array in scanf in c?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

C program to copy one matrix to another matrix?

#include main() { int array[100], minimum, size, c, location = 1; printf("Enter the number of elements in array\n"); scanf("%d",&size); printf("Enter %d integers\n", size); for ( c = 0 ; c < size ; c++ ) scanf("%d", &array[c]); minimum = array[0]; for ( c = 1 ; c < size ; c++ ) { if ( array[c] < minimum ) { minimum = array[c]; location = c+1; } } printf("Minimum element is present at location number %d and it's value is %d.\n", location, minimum); return 0; }


How you get the size of arrays from user?

in c simply add three lines in the begining of your program: int x; printf("enter the size of the array to be entered :"); scanf("%d",&amp;x); after that use x as your maximum limit of array in your program. in c++ just replace above printf &amp; scanf statements by cout&lt;&lt;"enter the size of the array to be entered :"; &amp; cin&gt;&gt;x; respectively and do not use brackets.


Program to perform Fibonacci search in c language?

#include&lt;stdio.h&gt; int main(){ int a[10],i,n,m,c=0; printf("Enter the size of an array: "); scanf("%d",&amp;n); printf("Enter the elements of the array: "); for(i=0;i&lt;=n-1;i++){ scanf("%d",&amp;a[i]); } printf("Enter the number to be search: "); scanf("%d",&amp;m); for(i=0;i&lt;=n-1;i++){ if(a[i]==m){ c=1; break; } } if(c==0) printf("The number is not in the list"); else printf("The number is found"); return 0; }


Write a C programme to find out sum of the array elements?

main(){int n,a[i],s;s=0;printf("enter no of elements in array");scanf("%d",&n);printf("Enter elements in array");for(i=;i


How do you find the minimum value of an array in c language?

Your best bet would probably be to iterate through the array using a for loop and compare each value to the current low and high values (which you would store in a local variable) for example: for each element in array { if current is less than lowest_value lowest_value = current else if current is greater than highest_value highest_value = current }

Related questions

Why and is not using ' and ' in reading a string using scanf?

I guess you wanted to ask, why is it scanf ("%s", array)and not scanf ("%s", &array).Well, array is by definition a pointer to the first element: array = &array[0]


C program to copy one matrix to another matrix?

#include main() { int array[100], minimum, size, c, location = 1; printf("Enter the number of elements in array\n"); scanf("%d",&size); printf("Enter %d integers\n", size); for ( c = 0 ; c < size ; c++ ) scanf("%d", &array[c]); minimum = array[0]; for ( c = 1 ; c < size ; c++ ) { if ( array[c] < minimum ) { minimum = array[c]; location = c+1; } } printf("Minimum element is present at location number %d and it's value is %d.\n", location, minimum); return 0; }


How you get the size of arrays from user?

in c simply add three lines in the begining of your program: int x; printf("enter the size of the array to be entered :"); scanf("%d",&amp;x); after that use x as your maximum limit of array in your program. in c++ just replace above printf &amp; scanf statements by cout&lt;&lt;"enter the size of the array to be entered :"; &amp; cin&gt;&gt;x; respectively and do not use brackets.


Program to perform Fibonacci search in c language?

#include&lt;stdio.h&gt; int main(){ int a[10],i,n,m,c=0; printf("Enter the size of an array: "); scanf("%d",&amp;n); printf("Enter the elements of the array: "); for(i=0;i&lt;=n-1;i++){ scanf("%d",&amp;a[i]); } printf("Enter the number to be search: "); scanf("%d",&amp;m); for(i=0;i&lt;=n-1;i++){ if(a[i]==m){ c=1; break; } } if(c==0) printf("The number is not in the list"); else printf("The number is found"); return 0; }


Write a C programme to find out sum of the array elements?

main(){int n,a[i],s;s=0;printf("enter no of elements in array");scanf("%d",&n);printf("Enter elements in array");for(i=;i


How do you find the minimum value of an array in c language?

Your best bet would probably be to iterate through the array using a for loop and compare each value to the current low and high values (which you would store in a local variable) for example: for each element in array { if current is less than lowest_value lowest_value = current else if current is greater than highest_value highest_value = current }


C program for linear search using non recursive functiontion?

void main(){int a[10],i,n,m,c=0;clrscr();printf("Enter the size of an array");scanf("%d",&n);printf("\nEnter the elements of the array");for(i=0;i


Sample program of single-dimentional array?

#include "stdio.h" #define SIZE 100; void main() { int array[SIZE], i, size; printf("\nEnter the Size off Array :- "); scanf("%d", &amp;size); printf("\nEnter the Elements of Array :- ")' for(i = 0; i &lt; size; i++) scanf("%d", &amp;array[i]; printf("\nThe Elements of entered Array :- "); for(i = 0; i &lt; size; i++) printf("%7d", array[i]); }


How elements are inserted in a 1-D array?

for(i=0;i&lt;10;i++) { scanf("%d",&amp;a[i] ); }


Write a program to merge two arrays eliminating duplicate elements in c plus plus?

#include&lt;stdio.h&gt; main() { int *ptr; int i,j,k=0,n,temp,n1,n2,c[20]; printf("\nEnter then no. os elememt of 1st array :"); scanf("%d",&amp;n1); printf("\nEnter the element :\n"); ptr=(int *)malloc(n1* sizeof(int)); for(i=0;i&lt;n1;i++,k++) { scanf("%d",ptr+i ); c[k]=*(ptr+i); } printf("\nEnter then no. os elememt of 2st array :"); scanf("%d",&amp;n2); printf("\nEnter the element :\n"); ptr=(int *)malloc(n2* sizeof(int)); for(j=0;j&lt;n2;j++,k++) { scanf("%d",ptr+j ); c[k]=*(ptr+j); } for(i=0;i&lt;n1+n2;i++) { for(j=0;j&lt;n1+n2;j++) { if(c[i]&lt;c[j]) { temp=c[i]; c[i]=c[j]; c[j]=temp; } } } printf("\nAfter combined and sorted both array : \n"); for(i=0;i&lt;n1+n2;i++) printf("Element [%d] = %d\n",i+1,c[i]); }


Scanf in java?

There is no scanf in Java. It is one of the keywords used in C Programming language


C program to accept a sentence using scanf?

scanf ("%[^\n]s", sentence);