Click here to Skip to main content
15,917,473 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: I can't compile and put it as a variable and matrix Pin
jeron15-Nov-20 14:21
jeron15-Nov-20 14:21 
GeneralRe: I can't compile and put it as a variable and matrix Pin
jsc4226-Nov-20 5:55
professionaljsc4226-Nov-20 5:55 
GeneralRe: I can't compile and put it as a variable and matrix Pin
David Crow9-Nov-20 2:52
David Crow9-Nov-20 2:52 
GeneralRe: I can't compile and put it as a variable and matrix Pin
jeron19-Nov-20 4:05
jeron19-Nov-20 4:05 
Questioni need your help Pin
Member 149820522-Nov-20 11:09
Member 149820522-Nov-20 11:09 
AnswerRe: i need your help Pin
Victor Nijegorodov2-Nov-20 20:36
Victor Nijegorodov2-Nov-20 20:36 
QuestionDifference between current system time and time from user input in c Pin
Member 1497910831-Oct-20 6:00
Member 1497910831-Oct-20 6:00 
AnswerRe: Difference between current system time and time from user input in c Pin
Mircea Neacsu31-Oct-20 6:59
Mircea Neacsu31-Oct-20 6:59 
GeneralRe: Difference between current system time and time from user input in c Pin
Richard Andrew x6431-Oct-20 8:03
professionalRichard Andrew x6431-Oct-20 8:03 
GeneralRe: Difference between current system time and time from user input in c Pin
Mircea Neacsu31-Oct-20 8:14
Mircea Neacsu31-Oct-20 8:14 
GeneralRe: Difference between current system time and time from user input in c Pin
Richard MacCutchan31-Oct-20 9:38
mveRichard MacCutchan31-Oct-20 9:38 
GeneralRe: Difference between current system time and time from user input in c Pin
Richard Andrew x6431-Oct-20 10:28
professionalRichard Andrew x6431-Oct-20 10:28 
GeneralRe: Difference between current system time and time from user input in c Pin
Richard MacCutchan31-Oct-20 21:22
mveRichard MacCutchan31-Oct-20 21:22 
GeneralRe: Difference between current system time and time from user input in c Pin
Richard Andrew x641-Nov-20 9:58
professionalRichard Andrew x641-Nov-20 9:58 
GeneralRe: Difference between current system time and time from user input in c Pin
Richard MacCutchan1-Nov-20 21:58
mveRichard MacCutchan1-Nov-20 21:58 
AnswerRe: Difference between current system time and time from user input in c Pin
Daniel Pfeffer31-Oct-20 11:24
professionalDaniel Pfeffer31-Oct-20 11:24 
QuestionSearching and displaying a record in Array of Structure in c Pin
Member 1497910829-Oct-20 16:45
Member 1497910829-Oct-20 16:45 
AnswerRe: Searching and displaying a record in Array of Structure in c Pin
CPallini29-Oct-20 21:27
mveCPallini29-Oct-20 21:27 
I would have written something similar to
C
#include <stdio.h>

#define EMPLOYEE_ARRAY_SIZE 10
#define NAME_MAX_LENGTH 30
#define NOT_FOUND  -1


struct employee
{
  int id;
  char name[NAME_MAX_LENGTH];
};


int find_employee_by_id( const struct employee emp_array[], int emp_array_size, int id);
void print_employee( const struct employee * pemp );

int main()
{
  struct employee emp_array[EMPLOYEE_ARRAY_SIZE] =
  {
    { 1, "foo"}, {2, "boo"}, {3, "goo"}, // .. other items here
  };

  int id = 2;

  int index = find_employee_by_id( emp_array, EMPLOYEE_ARRAY_SIZE, id );

  if ( index !=  NOT_FOUND )
  {
    printf("found emplyee details:\n");
    print_employee( & emp_array[index] );
  }
  else
  {
    printf("employee with id = %d not found\n", id);
  }

  return 0;
}


int find_employee_by_id( const struct employee emp_array[], int emp_array_size, int id)
{
  int index;
  for (index = 0; index < emp_array_size; ++ index)
    if ( emp_array[index].id == id)
      return index;
  return -1;
}

void print_employee( const struct employee * pemp )
{
  printf("id   = %d\n", pemp->id);
  printf("name = %s\n", pemp->name);
}

"In testa che avete, Signor di Ceprano?"
-- Rigoletto

QuestionHow to convert my MDI Application to open each window as a separate instance of the application Pin
manoharbalu23-Oct-20 0:09
manoharbalu23-Oct-20 0:09 
AnswerRe: How to convert my MDI Application to open each window as a separate instance of the application Pin
trønderen23-Oct-20 0:34
trønderen23-Oct-20 0:34 
GeneralRe: How to convert my MDI Application to open each window as a separate instance of the application Pin
manoharbalu23-Oct-20 0:49
manoharbalu23-Oct-20 0:49 
GeneralRe: How to convert my MDI Application to open each window as a separate instance of the application Pin
trønderen23-Oct-20 8:04
trønderen23-Oct-20 8:04 
GeneralRe: How to convert my MDI Application to open each window as a separate instance of the application Pin
Victor Nijegorodov23-Oct-20 8:35
Victor Nijegorodov23-Oct-20 8:35 
GeneralRe: How to convert my MDI Application to open each window as a separate instance of the application Pin
trønderen23-Oct-20 9:32
trønderen23-Oct-20 9:32 
GeneralRe: How to convert my MDI Application to open each window as a separate instance of the application Pin
Victor Nijegorodov23-Oct-20 10:26
Victor Nijegorodov23-Oct-20 10:26 

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.