language large_stringclasses 1
value | text stringlengths 9 2.95M |
|---|---|
C | #include<stdio.h>
#include<windows.h>
#include<stdlib.h>
int main() {
/*int n = 5;
do
printf("countdown %d !!!\n", n);
while (n-- > 0);
printf("ǡ̾~~\n");*/
//goto
/*goto A;
B:
printf(" 1\n");
printf(" 2\n");
printf(" 3\n");
printf(" 4\n");
printf(" 5\n");
printf(" 6\n");
goto C;
A:
printf(" 7\n");
... |
C | #include "tests.h"
int main() {
setup();
Socket * sock = malloc(sizeof(Socket));
*sock = (Socket) {.data = NULL};
assert(netConnect(sock) == ENULL_POINTER && "Did not receive the expected value for null data");
free(sock);
cleanup();
}
|
C | //
// Created by Once on 2019/7/22.
//
#ifndef TREE_BTREE_H
#define TREE_BTREE_H
// 键值数组结构
typedef struct column{
int id; // 关键字
char title[70];
} Column;
// B树结点
typedef struct bnode{
int size; // 当前关键字数目
Column **columns; // 键值数组
struct bnode **children; // 儿子指针数组
struct bnode *parent; //父指... |
C | /* This program is a part of RW mudlib
* See /doc/help/copyright for more info
-----------------------------------------
* File : Lock.c
* Author :
* Date : 2003-05-02
* Note : O
* Update :
* o 2000-00-00
*
-----------------------------------------
*/
#include <map.h>
#include <lock.h>
#include <f... |
C | #include<stdio.h>
void main(){
const int first;
int second;
const int third;
printf("enter value:\n");
scanf("%d\n",&first);
scanf("%d\n",&second);
scanf("%d\n",&third);
printf("first value=%d\n",first);
printf("second value=%d\n",second);
printf("third value=%d\n",third);
first=first+5;
second=second+3;... |
C | #include<stdio.h>
#define m 1000
int fun(int xx[], int n)
{
int cnt = 0;
for(int i = 3; i < n; i++)
{
for(int j = 2; j < i; j++)
if(i % j == 0) xx[cnt++] = i;
}
return cnt;
}
int main()
{
int xx[m];
for(int i = 0; i < m; i++)
xx[i] = 0;
int n = fun(xx, 17);
... |
C | #include <stdint.h>
#include <sys/mman.h>
#include <fcntl.h>
#include <unistd.h>
#include <limits.h>
#include "test.h"
#ifndef PAGE_SIZE
#define PAGE_SIZE sysconf(_SC_PAGE_SIZE)
#endif
#ifndef MAP_ANONYMOUS
#define MAP_ANONYMOUS 0
#endif
/* max mmap size, *start is the largest power-of-2 size considered */
static si... |
C |
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include "debug.h"
#include "ss_data.h"
// TODO: I should import the header file with the definition for the
/*
A view in the matrix allows to extract any subset of values from a
matrix.
*/
struct matrix_view {
int lb[3];
int u... |
C | #include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <time.h>
#define SIZE 10000
typedef struct node {
int data;
struct node* leftChild;
struct node* rightChild;
struct node* parent;
int height;
} node_t;
// Define the AVL data structure
typedef struct AVL {
node_t* root;
... |
C | #include <stdio.h>
int main(int argc, const char * argv[]) {
// insert code here...
int banyakJenis, banyakPotong[5], i;
char jenisPotong[5];
// int h_dada = 2500, h_paha = 2000, h_sayap = 1500;
int h_satuan[5];
// int j_harga[5];
int j_bayar = 0;
int pajak = 0;
... |
C | // 6. Faça um algoritmo que determine se um número é divisível ou não por outro.
#include <stdio.h>
#include <stdlib.h>
int main()
{
int firstNumber = 0, secondNumber = 0;
printf("==*== DIVISÍVEL ==*==\n");
printf("Digite o primeiro número: ");
scanf("%d", &firstNumber);
printf("Digite o segundo número: "... |
C | #include <assert.h>
int main() {
int i;
int c;
if(!(c==0 && i==0))
return 0;
while(i<100) {
c=c+i; i=i+1; if (i<=0) break;
}
assert(c>=0);
return 0;
} |
C | #include "format.h"
#include "string.h"
static inline
char digit_to_ascii (uint_fast8_t digit)
{
if (digit < 10)
return digit + '0';
else
return (digit - 10) + 'A';
}
static inline
void creverse (char* begin, char* end)
{
if (begin == end)
return;
--end;
while (begin < end) {
char tmp = *begin;
*begin... |
C | #include "nemu.h"
/* We use the POSIX regex functions to process regular expressions.
* Type 'man regex' for more information about POSIX regex functions.
*/
#include <sys/types.h>
#include <regex.h>
enum {
NOTYPE = 256,EQ,NEQ,REG,NUM,HEX,ADD,SUB,MUL,DIV,LP,RP,LSHIFT,RSHIFT,EITHER,BOTH,BIG,SMALL,BE,SE,OR,AND,DEREF... |
C | #include<stdio.h>
#include<stdlib.h>
#include<conio.h>
#include<math.h>
void binary(int b[],int x)
{
int i;
for(i=0;i<4;i++)
b[i]=0;
i=3;
while(x>0)
{
b[i]=x%2;
x=x/2;
i--;
}
}
int add(int p[],int k[],int carry)
{
int x,j;
for(j=3;j>=0;j--)
{
x=p[j];
p[j]=x^k[j]^carry;
if(((x==1)&&(k[j]==1))||((k[j]==1)&&(carry=... |
C | #include <stdio.h>
#include <stdlib.h>
/*
使用两次二分查找找到第一个和最后一个K
*/
int getFirstK(int* data, int k, int start, int end) {
if (start > end){
return -1;
}
int middleIndex = (start + end) / 2;
int middleData = data[middleIndex];
if (middleData == k) {
if ((middleIndex > 0 && data[middleIndex - 1] != k) || mid... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* printf.c :+: :+: :+: ... |
C | #include<stdio.h>
#include<conio.h>
#include<stdlib.h>
#include<malloc.h>
typedef struct node{
float val;
struct node *next;
}node;
node *start=NULL;
node *create(node *start){
float num;
printf("\nEnter value: ");
scanf("%f",&num);
node *ptr,*new_node;
while(num!=-1){
new_n... |
C | #include "libft.h"
int ft_strncmp(const char *s1, const char *s2, size_t n)
{
size_t i;
if (s1 == NULL && s2 == NULL)
return (0);
i = 0;
while (i < n && (i < ft_strlen(s1) || i < ft_strlen(s2)))
{
if (((unsigned char *)s1)[i] != ((unsigned char *)s2)[i])
return (((unsigned char *)s1)[i] - ((un... |
C | ERROR: type should be string, got "https://www.codechef.com/CORU2019/problems/ROBRESC/\n\n/* AUTHOR:AKASH JAIN\n* USERNAME:akash19jain \n* DATE:16/03/2019 \n*/\n#include<stdio.h>\n#include<math.h>\n#include<string.h>\n#include<stdlib.h>\n#include<stdbool.h>\n#define mod 1000000007\nint cmp(const void * a,const void * b)\n{\n return (*(int*)b - *(int*)a);\n}\n\nint main()\n{\n long long t;\n scanf(\"%lld\",&t);\n while(t--)\n {\n long long n,p,q,l,r,x,j;\n scanf(\"%lld%lld%lld\",&n,&p,&q);\n long long arr[n],sum=0,i,coins[q],max=0;\n for(i=0;i<n;i++)\n {\n scanf(\"%lld\",&arr[i]);\n sum+=arr[i];\n }\n for(i=0;i<q;i++)\n {\n scanf(\"%lld%lld%lld\",&l,&r,&x);\n long long z=(r-l+1)*x;\n coins[i]=z;\n //printf(\"%lld \",coins[i]);\n }\n qsort(coins,q,sizeof(coins[0]),cmp);\n for(i=0;i<p;i++)\n {\n sum+=coins[i];\n }\n printf(\"%lld\\n\",sum);\n }\n return 0;\n}\n" |
C | // Copyright (c) 2020 Raytheon BBN Technologies, Inc. All Rights Reserved.
//
// This document does not contain technology or Technical Data controlled under either
// the U.S. International Traffic in Arms Regulations or the U.S. Export Administration
//
// Distribution A: Approved for Public Release, Distribution Un... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* orientate_sprite.c :+: :+: :+: ... |
C | /* Copyright: (c) 2005 ImmenStar Inc. All Rights Reserved. */
#include "iros_config.h"
#include "plat_common.h"
#include <stdio.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
#include <cyg/infra/cyg_type.h>
#include <stddef.h>
#ifdef HAVE_ZTE_SIJIE
extern cs_status epon_request_onu_reset_set(void);
#endi... |
C | #ifndef MY_ESCAPE_H
#define MY_ESCAPE_H
#include "myAbstractSyntax.h"
///
/// \brief find and record escapes in the given expression.
/// \param[in] exp the expression inside which to look for.
/// \return this function has no return value.
///
/// \remark after called, variable escape information i... |
C | #include <intrinsics.h>
#include "indicator.h"
unsigned char number[] =
{
0x3f, //0
0x06, //1
0x5b, //2
0x4f, //3
0x66, //4
0x6d, //5
0x7d, //6
0x07, //7
0x7f, //8
0x6f //9
};
volatile unsigned char data[3];
volatile unsigned char LEDS[];
void IND_Init(void)
{
... |
C | /*
ID: wangbn11
LANG: C
TASK: range
*/
/*
* =====================================================================================
*
* Filename: range.c
*
* Description: dp -- caculate the max length one square can make; do from the
* right corner.
*
* Version: 1.0
* Created: 11/26... |
C | #include<stdio.h>
#define INCH 2.54 // 1 inch = 2.54cm
int main(void)
{
float cm;
printf("Enter a height in centimeters:");
scanf("%f",&cm);
while(cm>0)
{
printf("%.1f cm = %d feet, %.1f inches\n",cm,(int)(cm/INCH/12),cm/INCH-(int)(cm/INCH/12)*12);
printf("Enter a height in centimeters(<=0 to quit)... |
C | #include <stdio.h>
int main(){
char txt;
while(1){
scanf("%c",&txt);
if(txt=='\\')break;
else if(txt=='\''||txt=='\"');
else printf("%c",txt);
}
return 0;
}
|
C | #include <stdio.h>
#include <string.h>
#include"darray_int.h"
void testFunc()
{
darray *myDarr;
int myInt;
int res;
int numOfItems;
AdtStatus tmp;
tmp = darrayCreate(&myDarr,100);
printf("result of create is :%d\n",tmp);
myDarr = darrayAdd(myDarr,8);
myDarr = darrayAdd(myDarr,10);
myDarr = darrayAdd(myDarr,... |
C | #include "PCA9632.h"
/**
* @brief I2C write
*
* ___________________________________________________________________
* | start | slave_addr + wr_bit + ack | write n bytes + ack | stop |
* --------|---------------------------|----------------------|------|
*
* @param addr slave device adress
* @param data_wr po... |
C | #include "stdlib.h"
#include "stdio.h"
#include "pthread.h"
#define amount_of_string 4
pthread_key_t global_key;
void* thread(void* tmp);
void add_global_var();
int main() {
pthread_t id_first_thread, id_second_thread, id_third_thread, id_fourth_thread;
pthread_attr_t attribute;
int error_initial = pthre... |
C | #include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
#include <limits.h>
#include <stdbool.h>
int main(){
int n;
scanf("%d",&n);
int a[n];
for(int arr_i = 0; arr_i < n; arr_i++){
scanf("%d",&a[arr_i]);
}
int s,l,v,r;
l=a[0];
for(int t=... |
C | # include <stdio.h>
int main() {
unsigned int a = 60;
unsigned int b = 12;
int c = 0;
c = a&b;
printf("c's value:%d\n",c);
c = a|b;
printf("c's value:%d\n",c);
c = a^b;
printf("c's value:%d\n",c);
c = ~a;
printf("c's value:%d\n",c);
c = a<<2;
printf(... |
C | #include <stdio.h>
int main(void)
{
int num;
printf("整数を入力してください:");
scanf("%d", &num);
switch(num % 3){
case 0 : puts("その数は3で割り切れます。");
break;
case 1 : puts("その数を3で割った剰余は1です。");
break;
case 2 : puts("その数を3で割った剰余は2です。");
break;
}
ret... |
C | // strcopy1.c - copy using an array iterator.
// compile with: gcc -o strcopy1 strcopy1.c
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define BUF_SZ 200
int main(void)
{
char* str = "Be like a headland of rock on \
which the waves break incessantly but it \
stands fast and around it the seething \
of... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
typedef struct Archivo{
char nombre[128];
char tipo;
char usuario[50];
int permiso;
char ruta[1024];
}ARCHIVO;
typedef struct nodo* NODO;
typedef struct nodo* LISTA;
struct nodo {
char elemento;
NODO sig;
};
ARCHIVO arc1;
NODO... |
C | /*
* button.c
*
* Created on: Mar 17, 2021
* Author: Jeff
*/
#include "button.h"
genericSensor_t button_init(GPIO_TypeDef *port, uint16_t pin) {
button_t _btn = {0};
genericSensor_t gBTN = {0};
gBTN.sensorType = GPIO_BUTTON;
gBTN.read = button_read;
gBTN.sensor.button = _btn;
gBTN.interface.PIN.po... |
C | #include <stdio.h>
int main()
{
int k, j, p;
for (k = 3; k < 100; k++)
{
p = 0;
for (j = 2; j < k; j++)
{
if ((k % j) == 0)
{
p = 1;
break;
}
}
if (p == 0)
{
printf("%d\n", k);
}
}
return 0;
} |
C | #include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include "Output.h"
#include "RewriteElement.h"
#include "AddElement.h"
int main(int argc, char *argv[])
{
int answer, N, indx;
printf("Enter the size of array: ");
scanf_s("%d", &N);
int *dynarray = (int*)calloc(N,sizeof(int)); // Allocati... |
C | /*
* This file is part of the FDNPKG project
* Copyright (C) Mateusz Viste 2013
*
* Simple test program for the FDNPKG url parser.
*/
#include <stdio.h>
#include "parseurl.h"
int main(int argc, char **argv) {
char host[1024];
char path[1024];
int port;
int proto;
if (argc != 2) {
... |
C | #include <stdio.h>
#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/shm.h>
#include <string.h>
#include <stdlib.h>
#include "semafory.h"
#include "pamiec.h"
#include "unistd.h"
#include <sys/mman.h>
#define SIZE 41
typedef struct Bufor_Cykliczny
{
int size;
char bufor[SIZE];
} Bufor_Cykliczny;
... |
C | #include <stdio.h>
#include <stdlib.h>
#include "Artimatics.h"
#include "Test.h"
#include "Bitwise.h"
#define SQR2(x) (x*x)
inline int SQR(int x)
{
return x*x;
}
int main()
{
int Num1,Num2;
printf("Enter the two numbers\n");
scanf("%d%d",&Num1,&Num2) ;
printf("Result of Sum of %d and %d is %d\n",Num1,Num2,sum(Nu... |
C | /*
Author: Abdallah Mahran
Ref: https://leetcode.com/problems/maximum-depth-of-binary-tree/description/
Date: 9/16/2017
*/
// Includes
#include "../common.h"
// Types
// Functions
// solution 1
void dep(TreeNode* node, int *depth, int cd)
{
if(node == NULL)
return;
if(cd == *depth)
*depth++;
dep(node->left, ... |
C | /*
* 问题:让逆波兰运算中支持%运算,注意考虑负数的情况
*/
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <math.h> //主要用于fmod 函数
#include <float.h>
#define MAXOP 100 //最大输入
#define MAXVAL 100 //栈最大空间
#define MAXBUF 100 //存放当前字符
#define NUMBER '0'
int op = 0, bufp = 0;
double val[MAXVAL];
char buf[MAXBUF];
void push(double... |
C | #include <stdio.h>
// as of c11 we are including void since we are not returning anything
// as argument
int main(void)
{
printf("Hey nerds\n");
return 0;
} |
C | //Copyright 2011-2017 Tyler Gilbert; All Rights Reserved
#include "son_local.h"
static int edit_raw_data(son_t * h, const char * key, const void * data, son_size_t size, son_value_t new_data_marker);
int son_edit_float(son_t * h, const char * key, float v){
return edit_raw_data(h, key, &v, sizeof(v), SON_FLOAT);
}... |
C | // Task2:
// Write the swap16, swap32, swap64 functions that swap bytes in
// uint16_t, uint32_t, and uint64_t (endianness conversions)
#include "ProCamp_Task_2_swap.h"
void task2_main_swap()
{
printf("Task 2: swap \n");
printf("Start \n\n");
uint16_t a16_old = 0xA1B2;
uint16_t a16_new = swap16(a16_old);
uint3... |
C | /** Autor: Gabriel Dias **/
/**
* Faa um algoritmo que realize a leitura do saldo de uma conta. Em seguida, o algoritmo
* dever apresentar um menu ao usurio com as seguintes opes:
*
* 1. Exibir saldo;
* 2. Realizar saque;
* 3. Realizar depsito;
*
* -> A opo 1 dever apresentar o saldo digitado pelo usurio;
*
* -> A... |
C | #ifndef UNIFORMS_H
#define UNIFORMS_H
#include "math/mat4.h"
#include <vulkan/vulkan.h>
#include "graphics/texture.h"
#include <stdint.h>
#define CS_WHOLE_SIZE -1
typedef struct
{
mat4 model;
mat4 view;
mat4 proj;
} TransformType;
typedef struct DescriptorPool DescriptorPool;
// A struct containing an entire de... |
C | /******************************************************************************
* LibGHT, software to manage point clouds.
* LibGHT is free and open source software provided by the Government of Canada
* Copyright (c) 2012 Natural Resources Canada
*
* Nouri Sabo <nsabo@NRCan.gc.ca>, Natural Resources Canada
* Paul... |
C | /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
/* Copyright (c) 2020
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of version 2 of the GNU General Public
* License as published by the Free Software Foundation.
*/
#ifndef _PROCESS_H_
#define _PROCESS_H... |
C | /*File name: message.c
*Type: C source file
*Date: 2017/04/24
*/
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <errno.h>
#include <sys/msg.h>
#include <string.h>
#include "msgdata.h"
void msgreceive(int msginfo_fd)
{
int msgid = -1;
struct message_info_struct msginfo;
long int msg... |
C | #include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdbool.h>
#include <curl/curl.h>
#include "get_url.c"
#define maxitem 100 //max item digits
#define MAX_TITLE 1000
#define MAX_LINK 10000
#define MAX_DATE 100
#define MAX_DES 100000
#define MAX_CAT 1000
#define MAXN_CAT 20
#define maxchar 1000000
t... |
C | #include <stdio.h>
#include <string.h>
int main() {
int test;
scanf("%d", &test);
while (test--) {
int input[85][2] = { 0, }, check[85] = { 0, }, result[85] = { 0, };
char a[85] = { 0, }, b[85] = { 0, };
scanf("%s %s", &a, &b);
for (int i = 0; i < strlen(a); i++) {
input[i][0] = a[(strl... |
C | #include <stdio.h>
int main(void) {
// pointers to a character array to define simple strings
char * name = "John Smith";
/**
* This method creates a string which we can only use for reading.
* If we wish to define a string which can be manipulated, we will
* need to define it as a local character array
*/
... |
C | #include<stdio.h>
void main()
{ int arr[100],n, ch, pos=-1, i;
printf("Enter the size of array: ");
scanf("%d", &n);
printf("Enter the elements of the array\n");
for(i=0; i<n; i++)
{ printf("\nNum %d:", i+1);
scanf("%d", &arr[i]);
}
printf("Enter the element you want to find: ");
scanf("%d", &ch);
... |
C | #include<stdio.h>
#include<stdlib.h>
#include<string.h>
int main()
{
char line[10], *ptr;
int len, i, result=1, total=0;
while(scanf("%s", line)!=EOF){
len=strlen(line);
ptr=line;
while(*ptr!='\0'){
result=1;
for(i=0; i<len-1; i++){
result*=26;
}
total+=(*ptr-64)*result;
ptr++;
len--... |
C | #include "drivers/mouse/mouse.h"
#include <stdint.h>
#include "drivers/gpio/gpio.h"
#include "lib/printk.h"
int32_t usleep(uint32_t usecs) {
int i;
for (i = 0; i < usecs*8e3; i++);
}
static const int gpio_clock = 23;
static const int gpio_data = 24;
static int mouse_x = 0,
mouse_y = 0;
// TODO S... |
C | /*
copyright xu(xusiwei1236@163.com), all right reserved.
Valid Anagram
==============
Given two strings s and t, write a function to determine if t is an anagram of s.
For example,
s = "anagram", t = "nagaram", return true.
s = "rat", t = "car", return false.
Note:
You may assume the string contains only lowerca... |
C | #include <stdlib.h>
#include "basic_operation.h"
#include "utils.h"
bool * add(bool * a, bool * b, int length, bool carry_in) {
// use one additional bit to store the most significant bit
// useful in some cases
bool * sum = (bool *)malloc(sizeof(bool) * (length + 1));
bool carry_out;
for (int i = 0; i < length;... |
C | #include <stdio.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <sys/stat.h>
#include <string.h>
#include <stdlib.h>
#include <fcntl.h>
/* Function which checks for the < symbol
Takes a list of arguements and size of list as paramaters
Returns the location of the special character... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
typedef struct line {
char op, type;
unsigned addr;
unsigned size;
int unit;
} LINE;
typedef struct random_access_memory {
unsigned memory_size;
unsigned cache_size;
unsigned block_size;
unsigned block_count;
unsigned **cac... |
C | #define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward d... |
C | #include "command.h"
char peekchar() {
char c = getchar();
ungetc(c, stdin);
return c;
}
void consume_whitespace() {
while (1) {
char c = peekchar();
if (isalnum(c)) {
break;
} else {
getchar();
}
}
}
void read_command_name(struct command *... |
C | //average of the numbers
#include<stdio.h>
int main()
{
int num,a[100],avg=0,i,N;
printf("Enter the total numbers");
scanf("%d",&N);
printf("\nEnter the numbers");
for(i=1;i<=N;i++)
{
scanf("%d",&a[i]);
printf("\t%d",a[i]);
avg=avg+a[i];
}
printf("\nThe average value is %d",avg);
return 0;
}
|
C | // getchar_function.c
#include <stdio.h>
int main(void)
{
int c;
printf(" ϳ Է: _\b");
c = getchar();
printf("Է : %c\n", c);
return 0;
}
|
C |
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "aula0804.h"
#define NUMERO_ARGUMENTOS COMPRIMENTO_PIS_PASEP + 1
#define ARGUMENTO_INVALIDO 1
#define NUMERO_ARGUMENTOS_INVALIDO 2
#define OK 0
int
main (int argc, char *argv[])
{
unsigned indice;
char pisPasep[COMPRIMENTO_PIS_PASEP... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define BUFFER_SIZE 50
//Write a function that reverses the digits of a given floating-point
//number. The function should receive a double number and a pointer to
// an integer variable. In case of format error, it should set error to
// 1 and in case of ... |
C | /*
Exercise 1-14. Write a program to print a histogram of the frequencies of different characters
in its input.
*/
#include "stdio.h"
#define MAX 1000
main(){
char c;
int counts[MAX];
int i, j;
i = j = 0;
//initialize counts
for (i=0; i < MAX; i++){
counts[i] = 0;
}
while((c = getchar()) != EOF){
if (c !... |
C | /******************************************************************************
Напишите программу, которая запрашивает имя и фамилию, а затем выводит их в формате фамилия, имя.
*******************************************************************************/
#include <stdio.h>
int main()
{
char name[20];
... |
C | #pragma once
enum { QUEUE_SIZE = 5 };
typedef struct
{
char array[QUEUE_SIZE];
int front, rear;
}
QUEUE;
void initQueue(QUEUE* pq);
void enQueue(QUEUE* pq, char data);
char deQueue(QUEUE* pq);
int isEmpty(QUEUE* pq);
|
C | /*
Q5) Escreva uma função que receba, como entrada, uma cadeia de caracteres s e um inteiro n, e, em
seguida, retire o "sufixo" da cadeia s de tamanho n (isto é, retire os n últimos caracteres). Se a
cadeia não tiver pelo menos n caracteres, deve ser impressa a mensagem "erro". Por exemplo, se s
= "abcdefghi" e n = 3, ... |
C | #include <stdlib.h>
#include "two-sum.h"
int main(){
int nums[] = { 2, 7, 11, 15};
int target = 9;
int *result = twoSum(nums, 4, target);
if(result != NULL && (nums[result[0]]+nums[result[1]] == target)){
printf("WORKS!!\n");
} else {
printf(":(\n");
}
} |
C | // Uses ptrace to overwrite the vdso of a running process.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/user.h>
#include <sys/ptrace.h>
#include "kernel/elf.h"
#include "tools/ptutil.h"
#include "misc.h"
static addr_t aux_addr(int pid, unsigned type) {
struct user_regs_struct regs;
... |
C | /*
* TraceBuffer.c
*
*
* Created by Michael Weingert on 11-11-14.
* Copyright 2011 __MyCompanyName__. All rights reserved.
*
*/
#include "TraceBuffer.h"
#include "Constants.h"
#include "Structures.h"
#include <stdio.h>
#include <string.h>
void InitializeTraceBufferSEND()
{
int i;
TraceBuffer* temp;... |
C | #include <stdio.h>
#include <math.h>
#include <assert.h>
#include "util.h"
#include "cudd.h"
//Function wrappers around macros
DdNode *wrappedRegular(DdNode *f){
assert(f);
return Cudd_Regular(f);
}
void wrappedCuddRef(DdNode *f){
assert(f);
Cudd_Ref(f);
}
int wrappedCuddIsComplement(DdNode *f){
retur... |
C | #define thisprog "xe-oversample1"
#define TITLE_STRING thisprog" v 1: 17.March.2019 [JRH]"
#define MAXLINELEN 1000
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
/*
<TAGS> signal_processing filter </TAGS>
v 1: 17.March.2019 [JRH]
*/
/* external functions start */
char *xf_lineread1(ch... |
C | #include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include "macro.h"
int main(int argc, char *argv[])
{
char recvbuf[BUF_LEN];
ssize_t recvbytes;
int serverfd;
int clientfd;
struct sockaddr_in serveraddr;
struct s... |
C | #include <stdio.h>
#include "mkl.h"
#include <math.h>
#include "functions.h"
int main(void) {
int i;
int size = 1000;
int s_e_point = 50;
int fl_par = 50;
double *x;
//Allocate memmory
x = (double *) malloc(sizeof (double) * size);
if (x == NULL) exit(99);
x[0] = 0;
for( i = 1; i < size; i++) {
... |
C | //
// Created by Linus Bein Fahlander on 2018-03-05.
//
#include <stdint.h> /* Declarations of uint_32 and the like */
#include <pic32mx.h> /* Declarations of system-specific addresses etc */
#include "flow_control.h"
#include "../drivers/display/display_functions.h"
#include "../controllers/fingerprint_sensor.h"
#... |
C | /*
* Create a named stream pipe.
*/
#include <sys/types.h>
#include <sys/stat.h>
int /* return 0 if OK, -1 on error */
ns_pipe(name, fd)
char *name; /* user-specified name to assign to the stream pipe */
int fd[2]; /* two file descriptors returned through here */
{
int omask;
struct stat statbuff;
/*
*... |
C | /* This code is public domain
Authors: Nicolas Gast, 2013
nicolas.gast@epfl.ch
Jean-Yves Le Boudec, 2019
jean-yves.leboudec@epfl.ch
*/
#include <stdio.h> /* for printf() and fprintf() */
#include <sys/socket.h> /* for socket(), bind(), and connect() */
#include <arpa/inet.h> /* for s... |
C | //
// RingList.c
// Lab2
//
// Created by on 4/7/16.
// Copyright 2016 Sergey fedorenko. All rights reserved.
//
//
#include "RingList.h"
#include "Node.h"
#include <stdlib.h>
// Constants
const int kListError = -1;
//Create/delete a list
RingList *CreateList()
{
RingList *theList = (RingList *)malloc(sizeof(... |
C | /* ************************************************************************
*
* This file implements the json parser.
*
* Working example and terminology
* ================================
* We use following json to depict
* how it works:
* [1, 2, {"key": 3.4}]
*
* We call [...] as *array*, and {...} as ... |
C | #ifndef ESTRUTURAS
#define ESTRUTURAS
typedef struct NoArvore
{
char temValor;
unsigned char letra;
unsigned int quantidade;
struct NoArvore *esq;
struct NoArvore *dir;
} NoArvore;
typedef struct NoFila
{
NoArvore *dado;
struct NoFila *prox;
} NoFila;
typedef struct
{
char *codigo;
... |
C | #include <stdio.h>
int main(){
int a = 1;
int b = 2;
int c = 3;
unsigned int d = 3;
printf("---------------------------------------------\n");
printf("and or xor \n\n");
printf("0x%08x | 0x%08x = 0x%08x\n",a,b, a|b);
printf("0x%08x & 0x%08x = 0x%08x\n",a,b, a&b);
printf("0x%08x ^ 0x%08x = 0x%08x\n",a,b,... |
C | #include <stdlib.h>
#include "binary_heap_pro.h"
#define ROOT_IDX 0u
#define LEFT_CHILD(x) (2u * x) + 1u
#define RIGHT_CHILD(x) 2u * (x + 1u)
#define PARENT(x) (x - 1u) / 2u
/* I'm assuming a decent compiler will inline the next two functions; if not they can be made #define macros. */
void exch(... |
C | /*
* Say ip
* Written by Chun-Hsiang Chao
* Date:20191002
*/
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
void say_char(char c){
FILE *in,*out;
char filename[100];
if(c=='.'){
sprintf(filename,"/home/pi/Music/voice/dot.pcm",c);
}
else{
sprintf(filename,"/home/pi/Music/voi... |
C | #include "debug.h"
#include <stdio.h>
#include <string.h>
#include "array.h"
static const size_t string_buffer_size = 1 * 1024 * 1024; // 1 MB
// static char string_buffer[string_buffer_size];
static array g_string_buffer;
static const size_t error_message_count = 32;
static const char *error_messages[error_messag... |
C | // Description----------------------------------------------------------------|
/*
* Initialises a struct with Name and Age data. Displays results on LEDs and
* LCD.
*/
// DEFINES AND INCLUDES-------------------------------------------------------|
#define STM32F051
//>>> Uncomment line 10 if using System Workbench... |
C | #include <stdio.h>
#include <stdlib.h>
int main()
{
int
char nama[30];
char alamat[40];
char nomer[20];
char jurusan[20];
char universitas[30];
printf("===================================\n");
printf("----Masukkan Data Diri Anda----\n");
printf("===================================\n... |
C | #include <stdio.h>
#define TAILLE 10
int main(){
int i;
int tab[TAILLE]={1, 2, 3, 4, 5, 6, 7, 8, 9, 10}, tab_copy[TAILLE];
for (i=0; i<TAILLE; i++){
tab_copy[i]=tab[i];
printf("tab[%d]=%d\n", i, tab[i]);
printf("tab_copy[%d]=%d\n", i, tab_copy[i]);
}
return 0;
}
|
C | #include "monteCarlo.h"
#include "world.h"
#include "spgrid.h"
#include <string.h>
#define DIAMETER 1 /* Particles have diameter 1 */
static bool collidesHelper(Particle *p1, Particle *p2)
{
/* Returns TRUE if there is NO collision! */
return nearestImageDistance2(p1->pos, p2->pos) >= SQUARE(DIAMETER);
}
static boo... |
C | #include <stdio.h>
struct numbers {
int num1;
int num2;
};
int main()
{
//struct numbers s1 = {.num2 = 22, .num1 = 11};
struct numbers s1 = { 22, 11 };
// struct numbers s2 = {.num2 = 30};
struct numbers s2 = { 2 };
printf("num1: %d, num2: %d\n", s1.num1, s1.num2);
printf("s2.num1: %d s2.num2: %d", s2.num1, s2... |
C | #include<stdio.h>
int main()
{
int i, x, y, sum=0;
scanf("%d %d", &x, &y);
if(x<y)
{
for(i=x+1; i<y; i++)
if(i%2==1 || i%2==-1)
sum=sum+i;
}
else
{
for(i=y+1; i<x; i++)
if(i%2==1 || i%2==-1)
sum=sum+i;
}
printf("... |
C | #include<stdio.h>
#include<stdlib.h>
typedef struct node{
int Val;
struct node* Prev;
struct node* Next;
}listNode;
listNode* receive(listNode* ptr,int n){
for (int i=0;i<n;i++){
listNode* node=(listNode*)malloc(sizeof(listNode));
scanf("%d", &node->Val);
node->Next = ptr;
... |
C | # include "util.h"
/*# include "efsManagement.h" */
# include "pManagement.h"
# include "hmac.h"
unsigned char * master_encdec_key ;
unsigned char * master_hmac_key ;
unsigned char * master_iv = "PURDUECS526CLASSFALL2015WLINUSA0";
unsigned char * password_file ;
unsigned char * master_filelist ="master.filelist";;... |
C | #include<stdio.h>
#include<string.h>
union per
{
int a;
char buf[32];
char c;
};
int main(void)
{
//联合体大小
printf("sizeof(union) = %ld\n", sizeof(union per));
union per a;
a.a = 44;
strcpy(a.buf, "CHINA");
//a.c = 'Y';
printf("%d\n", a.a);
printf("%s\n", a.buf);
//... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_options.c :+: :+: :+: ... |
C | #include <stdio.h>
#include <conio.h>
#define n 10
int main()
{
int i, j, b[n+1][n+1];
for(i=1;i<=n;i++)
{
b[1][i]=i;
}
for(i=2;i<=n;i++)
{
for(j=2;j<=n;j++)
{
b[i][j]=b[i-1][j-1];
}
b[i][1]=b[i-1][n];
}
for(i=1;i<=n... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.