How to allocate WCHAR* in windows with C

1 Answer

0 votes
#include <windows.h>
#include <stdio.h>
#include <stdlib.h>

int main(void)
{
    WCHAR* buffer = (WCHAR*)malloc(32 * sizeof(WCHAR));

    wcscpy_s(buffer, 32, L"windows programming in c"); 

    printf("%ws\n", buffer);

    free(buffer);

    char ch = getchar();

    return 0;
}
 



/*
run:

windows programming in c

*/

 



answered Apr 6, 2022 by avibootz

Related questions

2 answers 186 views
1 answer 106 views
1 answer 141 views
1 answer 177 views
1 answer 107 views
1 answer 106 views
...