How do I can display a string value without using the standard libraries in C language? -


how can display string value without using standard libraries in c language? please see following code:

//without using standard libraries other created int main() { string str = "hello"; //how can display str value without using standard libraries other created it? } 

here's how can :

// declare prototype write() function, // unspecified parameters because why not. extern long write();  int main(void) {     char const *str = "hello";      // retrieve length     unsigned long size = 0;     while(str[size])         ++size;      // write stdout (fd 1)     write(1, str, size);      return 0; } 

live on coliru.

of course, it's non-portable gets, , fail link or trigger ub on majority of systems other 1 pulled declaration (it's linux system call, declared in unistd.h retrieved coliru). then, that's why have standard library in first place.


Comments

Popular posts from this blog

How to connect android app to App engine -

gcc - MinGW's ld cannot perform PE operations on non PE output file -

php - display validation error message next to the textbox in codeigniter -