Click here to Skip to main content
15,886,963 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Service not created correctly under windows 11 but any older version. Pin
Randor 23-Sep-23 12:53
professional Randor 23-Sep-23 12:53 
GeneralRe: Service not created correctly under windows 11 but any older version. Pin
Rick R. 202323-Sep-23 13:06
Rick R. 202323-Sep-23 13:06 
QuestionRe: Service not created correctly under windows 11 but any older version. Pin
Randor 23-Sep-23 15:57
professional Randor 23-Sep-23 15:57 
AnswerRe: Service not created correctly under windows 11 but any older version. Pin
Rick R. 202324-Sep-23 6:37
Rick R. 202324-Sep-23 6:37 
GeneralRe: Service not created correctly under windows 11 but any older version. Pin
Randor 24-Sep-23 7:08
professional Randor 24-Sep-23 7:08 
Questionfingerprint sensor code with c++ Pin
ibiere21-Sep-23 23:56
ibiere21-Sep-23 23:56 
AnswerRe: fingerprint sensor code with c++ Pin
CPallini22-Sep-23 0:52
mveCPallini22-Sep-23 0:52 
QuestionType of array and printf specifiers Pin
Member 114540620-Sep-23 4:40
Member 114540620-Sep-23 4:40 
Hi there, I can't understand why my char type array isn't displayed with printf using string specifier %s. Here is my code.



#include <stdlib.h>
#include <string.h>
#include <stdio.h>

#define SIZE 10

void findbinary(int number, char result[], int index);

int main (void)
{
    int someNumber = 233;
    char result[SIZE];
    int index = 0;
    size_t i;
    findbinary(someNumber, result,0);
    printf("Decimal %d in binary = %c ",someNumber);
    for(i = 0; result[i] != '\0'; i++)
        printf("%s",result[i]);
}

void findbinary(int number, char result[], int index)
{
    
    if(number == 0){
        return;
    }
    result[index] = number % 2;
    findbinary(number / 2, result, index + 1);

}


It displayed properly if I use %d specifier, but... this is char array..?

Thank you.

modified 20-Sep-23 11:07am.

AnswerRe: Type of array and printf specifiers Pin
Mircea Neacsu20-Sep-23 5:11
Mircea Neacsu20-Sep-23 5:11 
AnswerRe: Type of array and printf specifiers Pin
k505420-Sep-23 5:36
mvek505420-Sep-23 5:36 
AnswerRe: Type of array and printf specifiers Pin
CPallini20-Sep-23 5:51
mveCPallini20-Sep-23 5:51 
QuestionHow to get disk model and serial number for the disk Windows is installed on Pin
JohnCodding19-Sep-23 20:41
JohnCodding19-Sep-23 20:41 
AnswerRe: How to get disk model and serial number for the disk Windows is installed on Pin
Richard MacCutchan19-Sep-23 21:59
mveRichard MacCutchan19-Sep-23 21:59 
GeneralRe: How to get disk model and serial number for the disk Windows is installed on Pin
Valentinor19-Sep-23 22:15
Valentinor19-Sep-23 22:15 
GeneralRe: How to get disk model and serial number for the disk Windows is installed on Pin
Richard MacCutchan19-Sep-23 22:26
mveRichard MacCutchan19-Sep-23 22:26 
AnswerRe: How to get disk model and serial number for the disk Windows is installed on Pin
Richard MacCutchan19-Sep-23 22:28
mveRichard MacCutchan19-Sep-23 22:28 
AnswerRe: How to get disk model and serial number for the disk Windows is installed on Pin
JohnCodding19-Sep-23 22:57
JohnCodding19-Sep-23 22:57 
GeneralRe: How to get disk model and serial number for the disk Windows is installed on Pin
David Crow20-Sep-23 2:08
David Crow20-Sep-23 2:08 
GeneralRe: How to get disk model and serial number for the disk Windows is installed on Pin
trønderen20-Sep-23 10:34
trønderen20-Sep-23 10:34 
GeneralRe: How to get disk model and serial number for the disk Windows is installed on Pin
jschell20-Sep-23 13:13
jschell20-Sep-23 13:13 
GeneralRe: How to get disk model and serial number for the disk Windows is installed on Pin
trønderen21-Sep-23 6:29
trønderen21-Sep-23 6:29 
GeneralRe: How to get disk model and serial number for the disk Windows is installed on Pin
Richard MacCutchan20-Sep-23 22:03
mveRichard MacCutchan20-Sep-23 22:03 
GeneralRe: How to get disk model and serial number for the disk Windows is installed on Pin
jschell21-Sep-23 4:57
jschell21-Sep-23 4:57 
GeneralRe: How to get disk model and serial number for the disk Windows is installed on Pin
trønderen21-Sep-23 6:23
trønderen21-Sep-23 6:23 
AnswerRe: How to get disk model and serial number for the disk Windows is installed on Pin
Dave Kreskowiak20-Sep-23 13:23
mveDave Kreskowiak20-Sep-23 13:23 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.