일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |
Tags
- string
- MongoDB
- insomnia
- HTTP
- 백준 10775번
- ERD
- 그래프 탐색
- 그리디
- Github
- DP
- Next
- trie
- Prisma
- router
- JavaScript
- pm2
- Express.js
- 이분 탐색
- MySQL
- localstorage
- 트라이
- ccw 알고리즘
- Keys
- 자바스크립트
- html5
- map
- branch
- outer join(외부 조인)
- PROJECT
- 게임 서버 아키텍처
Archives
- Today
- Total
dh_0e
[C++] memset, isupper/islower 본문
memset
- 메모리의 특정 영역을 지정된 값으로 초기화하는 함수
- 주로 배열이나 구조체의 초기화에 사용
- <cstring> 헤더에 포함
#include <iostream>
#include <cstring>
int main() {
char str[50] = "Hello, world!";
printf("Before memset: %s\n", str); // Before memset: Hello, world!
// str 7번째 값부터 5개의 바이트를 'X'로 설정
memset(str + 7, 'X', 5);
printf("After memset: %s\n", str); // After memset: Hello, xxxxx!
return 0;
}
isupper / islower
- 문자가 대문자인지 소문자인지 여부를 판별하는 함수
- <cctype> 헤더에 포함
#include <iostream>
#include <cctype>
int main() {
char ch = 'A', ch1 = 'a';
if (isupper(ch)) {
printf("%c는 대문자입니다.\n", ch);
}
if (islower(ch1)) {
printf("%c는 소문자입니다.\n", ch);
}
return 0;
}
'C++' 카테고리의 다른 글
[C++] stringstream (2) | 2024.07.22 |
---|---|
[C++] max_element, min_element, find (0) | 2024.07.12 |
[C++] map, unordered_map (0) | 2024.07.03 |
[C++] 행렬 곱셈(matrix multiplication) 정의와 그 이유, 구현 (0) | 2024.06.25 |
[C++] stoi/stol/stoll, <string> method (0) | 2024.06.24 |