Since writing the above code would be very time consuming, C permits two alternate ways of achieving the same thing. First, one might write:
char my_string[40] = {'T', 'e', 'd', '\0',};
But this also takes more typing than is convenient. So, C permits:
char my_string[40] = "Ted";
array can be intialied by anyways above.....
User Profile
Collapse
-
functions and arrays
void charfunc(char* );
char* charfuncptr(cha r* );
main()
{
char array[3]="ebc";
char* narr;
narr = array;
charfunc(array) ;
narr = charfuncptr(&ar ray[0]);
printf("\nnew array is %s",narr);
printf("\nnew array is %s",array);
}
void charfunc(char*... -
iam using miracle C compiler ...it was availble from net...
it says"parse error"Leave a comment:
-
-
function pointers
[code=c]#include <stdio.h>
static int my_function(int a)
{
printf("my_func tion: %d\n", a);
return (2*a + 3);
}
int main(void)
{
int (*new_function) (int) = my_function;
int x;
x = (*new_function) (10);
printf("main: %d\n", x);
return 0;
}
[/code]
...Last edited by sicarie; Feb 20 '08, 07:38 PM. Reason: Code tagsa re [code=cpp] and after your code [/code]. Please use them. They want to be used. They like to be used. -
yes ..iam to start with it ...
can anyone help on this
by saying some good material ..Leave a comment:
-
for example ....to go to the end of the vi file we need to press "G "
similar to this if anyone helps with some shortcut command it will be usefulLeave a comment:
-
-
hi
thanks for the reply ...
but this editor will be used by people who work in Unix with C
If anyone could give keyboard shortcuts for some VI commands
it will be helpfull for meLeave a comment:
-
-
-
pointers to Enum in C
[code=c]
#include <string.h>
enum State {yes=1, no=0}SS, *ptr;
struct Example {
enum State *ptr;
}EX;
enum State SS=yes;
main()
{
struct Example* PTR;
//enum State *ptr;
PTR=&EX;
ptr=&SS;
printf("%d",PTR->ptr);
}
[/code]
no errors ....but unable to print the enum values for "yes" and... -
Find version of a filesystem using C in Linux
how to find the version of a file using system calls in linux -
how do I find the value of the next enum
.
is there any other method ??Leave a comment:
-
enum and pointer help
[code=cpp]enum state { dis =0, enable=8 }sta;
struct SS {
enum state *poin;
}ss;
main()
{
struct SS *str;
str=&ss;
printf("%d",(st r->poin));
}
[/code]
how to access the enum variable through "str " -
hi
thanks for reply
still I need some logic to start with
please guideLeave a comment:
-
lookup table
hi
it will be helpful if anyone guides me how to write a lookup table in C,
iam new to it... -
hi ...
macro will be processed only during compilation and errors in macro will not be found by compiler...Leave a comment:
-
no error it shows while compilation , but after run there is no output ...
iam running this program using VI editor in linuxLeave a comment:
-
atoi
main() {
int i;
char* ptr ="str";
printf("%d",ato i(ptr));
}
no output is produced ...
pls tell me the problem ...
No activity results to display
Show More
Leave a comment: