Category: Questions and Answers

Question and answers.

When debugging the code I can see the value of max changing to 1. So my last loop only has one iteration. Can anyone please explain this behaviour?

void findMissingElementsInUnsortedList(int* array, int size, int max) { int hashTable[max] = { 0 }; for(int i = 0; i < size; i++) { hashTable[array[i]] = 1; } //Max changes to 1 for(int x = 0; x < max; x++) { if(hashTable[x] == 0) { printf("%d missing\n", x); } } } submitted by /u/teasa_stinga…

C++ vs C

I work in infosec as a consultant doing security assessments and want to get into code review, reverse engineering, and exploit dev. My peers suggest learning C instead of C++. I'm stubborn and want to learn C++. If I do go with C++, will it be fairly simple to take examples from plain C and…

What is a C++ way of passing any STL container to a function without templates?

I want to be able to send any STL container to a function and access some properties from it. For example, bindDescriptor(…, const MyContainer<uint32_t> &container) { vkBindDescriptorSet(…, container.size(), container.data()); } However, I do not want to use templates or any other type of function here to achieve this. Is there a type in C++17 or…

Enter your response section doesn’t takes input and directly jumps to next cout

/* Author: GrimSleet721363 Date: 15/03/2023 Time: 19:49 OS and Software: Windows 11 Home Os and Visual Studio Code as Software */ include <iostream> include <string> using namespace std; int main() { string hello; char size; int keyPressed; float value; string message; cout << "Enter The Greetings Message: "; getline(cin,hello); cout << "Enter the size of…