Solved

printf dont work

Posted on 2010-11-30
5
381 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

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ā€¦
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilationā€¦
The goal of this video is to provide viewers with basic examples to understand recursion in the C programming language.
The goal of this video is to provide viewers with basic examples to understand opening and reading files in the C programming language.

636 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