cplusplus
.com
TUTORIALS
REFERENCE
ARTICLES
FORUM
C++
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs
Forum
General C++ Programming
Please help for this problem////
Please help for this problem////
Oct 7, 2013 at 4:46pm UTC
Vuqar1618
(8)
Hi
The question asks that The one-dimensional array A of integers is given. Increase by 2 each its non-negative element.
I made this program but compiler says "variably modified 'h' at file scope" .
Please help!
#include <stdio.h>
int n;
int h[n];
int a;
int main(int argc, char *argv[])
{
scanf("%d",&n);
for(a=1;a<13;a++)
{
scanf("%f",&h[a]);
}
for(a=1;a<13;a++)
{
a=a+2;
printf("%d",a); }
system("pause");
getchar();
return 0;
}
Last edited on
Oct 7, 2013 at 4:47pm UTC
Oct 7, 2013 at 4:57pm UTC
Chriscpp
(368)
n has to be a constant.
Oct 7, 2013 at 5:00pm UTC
Vuqar1618
(8)
but it says array" A of integers" can you please rebuild this code?
Last edited on
Oct 7, 2013 at 5:03pm UTC
Oct 7, 2013 at 5:08pm UTC
MiiNiPaa
(8886)
Please do not double post. It clutters forum and is considered inappropriate.
Main thread link:
http://www.cplusplus.com/forum/beginner/112827/
Topic archived. No new replies allowed.