- #1
rclakmal
- 76
- 0
C programme ?
/* Program-8.4 */
#include <stdio.h>
int main()
{
int marks[5]= {89, 45, 73, 98, 39};
printf("%d\n", marks); //memory addres pointed by pointer
printf("%d\n", &marks[0]); //memory address of 1st element
printf("%d\n", *marks); //value pointed by pointer
printf("%d\n", marks[0]); //value of 1st array element
return 0;
i can't run these source code >it give an error saying
laka.c:6: warning: format ‘%d’ expects type ‘int’, but argument 2 has type ‘int *’
laka.c:7: warning: format ‘%d’ expects type ‘int’, but argument 2 has type ‘int *’
line 6 and 7 refers to the lines where marks and & marks[0] are present .
please point out the error >great help !
Homework Statement
/* Program-8.4 */
#include <stdio.h>
int main()
{
int marks[5]= {89, 45, 73, 98, 39};
printf("%d\n", marks); //memory addres pointed by pointer
printf("%d\n", &marks[0]); //memory address of 1st element
printf("%d\n", *marks); //value pointed by pointer
printf("%d\n", marks[0]); //value of 1st array element
return 0;
i can't run these source code >it give an error saying
laka.c:6: warning: format ‘%d’ expects type ‘int’, but argument 2 has type ‘int *’
laka.c:7: warning: format ‘%d’ expects type ‘int’, but argument 2 has type ‘int *’
line 6 and 7 refers to the lines where marks and & marks[0] are present .
please point out the error >great help !