Skip to main content

All Questions

1 vote
7 answers
408 views

Strlen, Malloc and address arithmetic

Need some help breaking down this C function. I'm stuck on the malloc line. I do not understand what the "+8" is doing and/or why it is even there. My research revealed it has something to ...
N6DYN's user avatar
  • 325
3 votes
1 answer
2k views

Use strlen with scanf(%ms)

Is it possible to use strlen() over a dynamically allocated string? FOR EXAMPLE: #include <stdio.h> #include <string.h> int main () { char *input=NULL; printf ("Enter a sentence: ")...
Mattia Surricchio's user avatar