Technofyed

Full Version: Help me in c
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi Everyone,
Can you give me some good Example?
This Example will print the Hello without using printf.
It is possible.
Can you help me?
Code:
#include <stdio.h>

int main(void) {
  printf("Hello World!\n");
  return 0;
}

Good enough?
Hi dude,

You can use puts or fputs:

int puts( char *str );

int fputs( const char *str, FILE *stream );

Here is a small example compiled on my Solaris 9 box:

Code:
#include <stdio.h>

int main()
{

puts("Hello World\n");

fputs("Hello World 2\n", stdout);
}

** Edit ** Please use code tags
I have a another way to print a message on screen without ; in the program

Code:
if(printf("Hello"))
{

}

what do you say about this?
Quote:what do you say about this?
Sure does look like the easiest way, but is it reliable? Smile
It's silly to have a conditional if on printf, just to remove the semi colon.

The semi colon indicates the end of line in C. Why on earth would you code around that?!
hello....
Code:
#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
printf(");
scanf(");
getch();
}
Horribly wrong...

#1 : Avoid using conio.h as it isn't a standard (& therefor non-portable) header
#2 : void main is the devil. Letting the compiler correct things you don't know or understand is a horrible way to program. Use int main always, always! Letting the OS know the program exited cleanly (with return 0) is both being a good coder, & also cleaning up after your mess. It's a great habit to get into. Use compiler correction as a crutch, & it will burn you one day.
Hi
Very true. what is the need for using if statement?
Regards
#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
int a,b,v....
printf("enter the value");
scanf(");
getch();
}
I do not know that how "hello" print in the C language without Printf.

#include <stdio.h>

int main(void)
{
printf("Hello World! \n");
return (0);
Getch();
}
#include<stdio.h>
#include<conio.h>
void main()
{
string str="Hello";
scanf(%s,&str);
getch();
}
(09-08-2010 06:30 AM)Fletcherr Wrote: [ -> ]#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
int a,b,v....
printf("enter the value");
scanf(");
getch();
}

You are right because i have been read this type of concept.
Nothing says "informal coding" like void main & a lack of proper indenting.
(05-23-2011 03:33 AM)no2pencil Wrote: [ -> ]Nothing says "informal coding" like void main & a lack of proper indenting.

Can you explain something about "informal coding"?
Reference URL's