Return an empty C-String
Posted
by
Evorlor
on Stack Overflow
See other posts from Stack Overflow
or by Evorlor
Published on 2013-10-19T03:15:32Z
Indexed on
2013/10/19
3:54 UTC
Read the original article
Hit count: 84
Simple Question:
How do you return an empty C-String with as little code as possible?
I have code that needs to return an empty char*
. I am looking for something along the lines of return "";
. I know there are several ways to do this, but I am looking for the most efficient way possible.
Using return "";
gives warning: conversion from string literal to 'char *' is deprecated [-Wdeprecated-writable-strings]
Thanks!
© Stack Overflow or respective owner