Solved

printf dont work

Posted on 2010-11-30
5
374 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

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
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…
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use nested-loops in the C programming language.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

747 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

11 Experts available now in Live!

Get 1:1 Help Now