Thread: what is the problem in this program?

  1. #1
    Registered User
    Join Date
    Nov 2017
    Posts
    22

    what is the problem in this program?

    Code:
    
    
    Code:
    #include<stdio.h>
    main()
    {
        int a[]={1,2,3,4,5};
        evenshow(a);
    }
    void evenshow(int a[])
    {
        int i;
        for(i=0;i<=5;i++)
        {
            if(a[i]%2==0)
            {
                printf("%d",a[i]);
            }
        }
    }

  2. #2
    Registered User
    Join Date
    May 2009
    Posts
    4,183
    Lack of a function prototype for evenshow is my guess.
    After that, I would guess user error.

    Tim S.
    "...a computer is a stupid machine with the ability to do incredibly smart things, while computer programmers are smart people with the ability to do incredibly stupid things. They are,in short, a perfect match.." Bill Bryson

  3. #3
    misoturbutc Hodor's Avatar
    Join Date
    Nov 2013
    Posts
    1,787
    a) Lack of function prototype
    b) Out-of-bounds read from array (a[5])

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Having some problem with a GCF program
    By Requinex in forum C++ Programming
    Replies: 2
    Last Post: 08-08-2009, 09:59 AM
  2. Replies: 4
    Last Post: 10-16-2008, 07:30 PM
  3. Program problem
    By Birdhaus in forum C++ Programming
    Replies: 6
    Last Post: 11-21-2005, 10:37 PM
  4. Math Equation Program (I can't find the problem with my program!)
    By masked_blueberr in forum C Programming
    Replies: 14
    Last Post: 07-06-2005, 11:53 AM
  5. problem with program
    By classicrockcj in forum C Programming
    Replies: 3
    Last Post: 11-21-2003, 01:00 AM

Tags for this Thread