Some garbage code (without error checking, for simplicity):
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
Type: Posts; User: CoiledAlizarine
Some garbage code (without error checking, for simplicity):
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
You can change to the UTF-8 codepage using setlocale() and use iswalpha()
#include <stdio.h>
#include <wchar.h>
#include <wctype.h>
#include <locale.h>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
void countOccurrences(char* str)
{
// 1) Count occurrences.
int occurrences[256] = {0};
for(; *str; str++)
...
Thanks, Malcolm Mclean. It is a pity that this is merely an unimplemented optimization. Well, at least in these cases #pragma pack(1) can save me some bytes with no performance cost.
#include <stdio.h>
struct A {
int i;
char a, b, c;
};
struct B {
struct {
int i;
You may be confusing the value and address of a and p.
Value Address
a 10 1116119516
p 1116119516 1116119520