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

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -