View Full Version : Convert char* to char in C
toanhoi
October 22nd, 2010, 03:15 PM
Hi Everybody,I have a question ,can you help me,please.I write a function to convert char* to char .Can you help me.Thanks you.This function converts char* to char and construct of convert(char xau[100],char* old)
Simian Man
October 22nd, 2010, 03:24 PM
Your question makes no sense to me. char* is a pointer to a character and is often used for NULL terminated strings. If all you want is the character pointed to, just dereference it:
char* x;
char a = *x;
If x points to a string, this will be the first character of that string.
TheBuzzSaw
October 22nd, 2010, 08:46 PM
Simian Man pretty much hit it right on the head. We need more details surrounding the context of your problem.
char a = yourCharPointer[0];
Something like that? It's basically the same thing as above.
Powered by vBulletin® Version 4.2.2 Copyright © 2024 vBulletin Solutions, Inc. All rights reserved.