Solved

printf dont work

Posted on 2010-11-30
5
376 Views
Last Modified: 2012-05-10
hallo;

i use printf but its not working ?

why???
#include <stdio.h>

#include <conio.h>

int main (void)

{

    short tabel[]={16,23,-7,10,85,-18,16,8};

    short i=0;

    short totaal=0;

    short kleinste=tabel[0];

    short temp=0;

    short size= sizeof(tabel)/sizeof(short);



     i=0;

     while (i < size)

     {

           temp=tabel[i];

           if (temp < kleinste)

           kleinste=temp;

     }

     printf("\n\n de kleinste getal in de tabel is %hd",kleinste);

     

    

    getchar();

    

}

Open in new window

0
Comment
Question by:kensy11
  • 3
  • 2
5 Comments
 
LVL 53

Expert Comment

by:Infinity08
ID: 34240759
What do you mean by "it's not working" ?

Does adding a \n at the end help ?

        printf("\n\n de kleinste getal in de tabel is %hd\n",kleinste);
0
 
LVL 53

Expert Comment

by:Infinity08
ID: 34240780
Btw, main returns an int, so you also actually have to return an int value at the end of main (generally 0 to indicate success).
0
 

Author Comment

by:kensy11
ID: 34240793
when i run it or compile it i dont get any text its just a black screen
0
 
LVL 53

Accepted Solution

by:
Infinity08 earned 500 total points
ID: 34240814
I just noticed that you're not incrementing i inside the loop, so the loop basically loops forever. You'll need to add a ++i somewhere near the end of the loop body.
0
 

Author Comment

by:kensy11
ID: 34240827
oooh thank you i forgot to do it
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
The goal of this video is to provide viewers with basic examples to understand opening and writing to files in the C programming language.
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…

896 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now