Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17


printf dont work

Posted on 2010-11-30
Medium Priority
Last Modified: 2012-05-10

i use printf but its not working ?

#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);

     while (i < size)
           if (temp < kleinste)
     printf("\n\n de kleinste getal in de tabel is %hd",kleinste);

Open in new window

Question by:kensy11
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
LVL 53

Expert Comment

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);
LVL 53

Expert Comment

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).

Author Comment

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

Accepted Solution

Infinity08 earned 2000 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.

Author Comment

ID: 34240827
oooh thank you i forgot to do it

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

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…
Examines three attack vectors, specifically, the different types of malware used in malicious attacks, web application attacks, and finally, network based attacks.  Concludes by examining the means of securing and protecting critical systems and inf…
The goal of this video is to provide viewers with basic examples to understand how to use strings and some functions related to them in the C programming language.
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.

661 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