what about strings? ive heard people refer to strings as a type of array.
eg array[]="abc";
array[]="a", "b", "c";
what about strings? ive heard people refer to strings as a type of array.
eg array[]="abc";
array[]="a", "b", "c";
a string logically is a collection of letters. so basically anything that is a collection of stuff can be refered to as an array. it doesn't mean that it is literatlly an "Array" but figuratively behaves like one.Originally Posted by megiddo
confusion sponsered by owensoft
Check out My Awesome Blog & News Jamaica
how do u use the gets n puts func to replace... printf an scanf
gets and puts - as in when writing to files?
Check out My Awesome Blog & News Jamaica
accepting input from a user... and outputing... i suppose to write a program without using printf or scanf... i heard the alternative is puts n gets... it nuh really mek much sense to me
Here is a simple example:
Code:#include <stdio.h> int main() { char name[256]; puts("please enter your name: "); gets(name); puts("your name is: "); puts(name); }
do you understand printf or scanf? why not use those?
or try what leoandru said
Check out My Awesome Blog & News Jamaica
I understand how to use them but ma lecturer was saying that puts n gets are more efficient and that we need to eliminate using the scanf or printf when coding... he said that um... when u enter n e thing other than an int usin scanf the prg will crash and our programs should be crash free...Originally Posted by owen
the assignment i have to do is to develop a paymaster kinda system... givin penalties for overdue bills n blah blah
Originally Posted by leoandru
Oh zeen... hmm thanks
yeah he is right about gets, it is more efficient when reading input but i can't say the same for printf vs puts, it's neither here nor there. However i know what kinda problems you may get into when trying to read intergers when using scanf, gets is jus one of the methods around that. If you going to use gets to read interger inputs then you will need to convert that string into an integer, but I know you are going to figure that one out .Originally Posted by Liquid Bunny