language large_stringclasses 1
value | text stringlengths 9 2.95M |
|---|---|
C | #include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <errno.h>
#include <stdlib.h>
#include <unistd.h>
//用lseek计算文件长度
int cal_len (char *pathname)
{
int fd = -1;
int ret = -1;
//第一步:打开文件
fd = open(pathname,O_RDONLY);
if (-1 == fd) //有时候也写成: (fd<0)
{
... |
C | //
// Created by andrea on 04/02/16.
// inspired by preshing.com/20120522/lightweight-in-memory-logging/
//
#ifndef TSAR_THREADSAFEROUTER_INMEMORYLOGGER_H
#define TSAR_THREADSAFEROUTER_INMEMORYLOGGER_H
#include <stdatomic.h>
#include <pthread.h>
typedef struct{
pthread_t tid; // Thread ID
c... |
C | #define _CRT_SECURE_NO_WARNINGS 1
#include "Stack.h"
void StackInit(Stack* ps, int n)
{
assert(ps);
ps->_a = (STDataType*)malloc(sizeof(STDataType)*n);
ps->_top = 0;
ps->_capacity = n;
}
void StackDestroy(Stack* ps)
{
assert(ps);
free(ps->_a);
ps->_a = NULL;
ps->_top = ps->_capacity = 0;
}
void StackPush(St... |
C | #include <stdio.h>
#include <string.h>
void strins(char *s, char *t){
char buf[100];
strcpy(buf, s);
strcpy(s, t);
strcpy(s, buf);
}
int main(){
int broj, add = 0, i = 0;
char s_broj[100];
printf("Unesite broj: ");
scanf("%d", &broj);
while(broj){
switch(broj%10){
... |
C | #include <sysdefs.h>
#include <ff.h>
FATFS FatFs; /* File system object for logical drive */
const TCHAR *rcstrings =
_T("OK\0DISK_ERR\0INT_ERR\0NOT_READY\0NO_FILE\0NO_PATH\0INVALID_NAME\0")
_T("DENIED\0EXIST\0INVALID_OBJECT\0WRITE_PROTECTED\0INVALID_DRIVE\0")
_T("NOT_ENABLED\0NO_FILE_SYSTEM\0MKF... |
C | /*
* 一个关于三叉树的题目,小于100的值代表树叶,大于100的值为分支点,建树的过程是水平方向建树,
* 输入格式:
* 先输入n,代表有n组数据,接下来n行,
* 输入4个数,第一个数代表根节点,接下来分别代表三个子节点,-1代表子节点不存在,
* 输入的顺序按照层次遍历的次序。接下来,要求寻找叶子节点的最短路径,最短路径是指不经过重复的边。
* 输入方式,首先输入一个值m,代表m行,接下来m行输入m个叶子节点和对应的优先级,
* 要求按优先级输出从上次到达的位置到该节点的最短路径,每条路径的最后一个节点要求输出目标叶子节点,最后要求回到根节点。
*
*/
#include <stdio.h>
#incl... |
C | #include <stdio.h>
int main(void)
{
int num1,num2,num3,num4,sum;//ϐnum1,num2,num3,num4,sum錾B
num1 = 0;//num10ƂB
num2 = 0;//num20ƂB
num3 = 0;//num30ƂB
num4 = 100;//num4100ƂB
sum = 0;//sum0ƂB
printf("50~ 10~ 5~ 1~ \n");//(50~ 10~ 5~ 1~)o͂B
for(num1 = 0; num1 <= 2; num1++)//JԂBnum15... |
C | #include <stdio.h>
#include <stdlib.h>
struct Node{
int data;
struct Node *next;
};
void i_front(struct Node** h_ref, int new_data){
struct Node* new_node = (struct Node * )malloc(sizeof(struct Node ));
new_node->data = new_data;
new_node->next = (*h_ref);
(*h_ref) = new_node;
}
void i_after(struct ... |
C | #include <stdio.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
#include <string.h>
#include <stdlib.h>
#include "sha1.h"
#define SERVER_PORT 47500
#define MAX_LINE 256
#define MAX_FILE_SIZE 12288
#define FLAG_HELLO ((uint8_t)(0x01 << 7))
#define FLAG_INSTRUCTION ((uint8_t... |
C | #include<stdio.h>
#include<stdlib.h>
int main() {
char str[] = { 4,5,3,6,8,9,7,1,2,0 };
int n = sizeof(str) / sizeof(str[0]);
int i, j;
for (i = 0; i < n; i++) {
for (j = 0; j < n - i - 1; j++) {
if (str[j] > str[j + 1]) {
int tmp = 0;
tmp = str[j];
str[j] = str[j + 1];
str[j + 1] = tmp;
}
... |
C | #ifndef __SERVER_H_
#define __SERVER_H_
#include "packet_interface.h"
/* Block the caller until a message is received on sfd,
* and connect the socket to the source addresse of the received message
* @sfd: a file descriptor to a bound socket but not yet connected
* @return: 0 in case of success, -1 otherwise
* @P... |
C | /*
Jason Yu
CSCB09
1005047110
yujason9
*/
#include <stdio.h>
/*
* Read an image from the standard input and set the red value of each pixel to
* zero.
*/
void remove_red()
{
int count = 4;
int input;
char magic_num[3];
int col;
int row;
int rgb;
int col_count = 0;
scanf("%s", magic_num);//Finds and prints m... |
C | /* using greedy algorithm , passed: 8ms*/
int maxProfit(int* prices, int pricesSize){
int i = 0, sum = 0;
if (NULL == prices ||
0 == pricesSize)
return 0;
for(i=1; i<pricesSize; i++)
{
if(prices[i] > prices[i-1])
{
sum += prices[i] - prices[i-1];
... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "empresa.h"
int cargarDescripcionEmpresa(eEmpresa listaEmpresa[],int tamEmpresa,int idEmpresa, char descripcion[])
{
int todoOk = 0;
int flag = 1;
if(listaEmpresa != NULL && tamEmpresa >0)
{
todoOk = 1;
for(int i = 0;i... |
C | #include "keyboard.h"
#include "memory.h"
#include "multitask.h"
#include "interrupt.h"
unsigned char scancodeMap[128] =
{
0, 27, '1', '2', '3', '4', '5', '6', '7', '8', /* 9 */
'9', '0', '+', /*'´' */0, '\b', /* Backspace */
'\t', /* Tab */
'q', 'w', 'e', 'r', /* 19 */
't', 'y', 'u', 'i', 'o', 'p', '['... |
C | #include "stdint.h"
#include "stdio.h"
#include "string.h"
#include "stdbool.h"
#include "stdlib.h"
#include "limits.h"
//Given the root of a binary tree, return the number of uni-value subtrees.
//A uni-value subtree means all nodes of the subtree have the same value.
//Input: root = [5,1,5,5,5,null,5]
//Output: 4
... |
C | // This PicoC program will attempt to change the I2C (SMBus) address of a
// thermal sensor from ADR_START to ADR_END. You must set up these two
// defines (immediately below this comment) properly. The ADR_START value
// must be the sensor's current address, and the ADR_END is what the new
// address is that you want... |
C | /**
* @file stm32.c
*
* @date Mehr 12, 1395 AP
* @author jupiter
* @description
*/
#include <stdint.h>
uint32_t F_CPU=8000000l;
//uint32_t STM32_PCLK1 = F_CPU/2;
//uint32_t STM32_PCLK2 = F_CPU;
//uint32_t STM32_DELAY_US_MULT = (F_CPU / 6000000L);
//uint32_t SYSTICK_R... |
C | #include <stdlib.h>
#include <stdio.h>
#include "queue.h"
void err(int);
void requestElement(MQ q1);
int sizeQueue1(MQ q1);
MQ mixQueues(MQ q1, MQ q2, int size_q1, int size_q2);
void printQueue(MQ q3);
int main(int argc, char const *argv[])
{
MQ q1 = createQueue();
MQ q2 = createQueue();
MQ q3 = createQu... |
C | #include "serial.h"
unsigned char flag1;
void InitializeSerialCommunication(void)
{
SPBRG = DIVIDER; // LOAD BAUD RATE VALUE
RCSTA = 0x90; // ENABLE SERIAL PORT AND CONTINUOUS RECEIVE
TXSTA = 0x24; // ENABLE TRANSMIT BIT AND HIGH SPEED
SYNC=0;
}
void SendB... |
C | #include <stdio.h>
#include <stdlib.h>
#include <pthread.h>
/* This variable will be incremented without protection */
int varWithoutMutex = 0;
/* This variable will be incremented with protection by
a mutex
*/
int varWithMutex = 0;
/* Mutexes must always be initialized before use.
You can initialize a statica... |
C | /* Little Bishops */
#include <stdio.h>
#define MAX_CANDIDATES 50
double solution_count;
void backtrack(int *a, int k, int n, int num, int row);
void construct_candidates(int *a, int k, int n, int *c, int *ncandidates,
int num, int row);
void backtrack(int *a, int k, int n, int num, int row) {
int c[MAX_... |
C | #include "xparameters.h"
#include "xgpio.h"
#include "xil_printf.h"
#define SW_DEVICE_ID XPAR_GPIO_0_DEVICE_ID
#define LED_DELAY 30000000
XGpio SW_Gpio;
int hashstr(const char *str) {
int hash = 5381;
int c;
while (c = *str++) {
hash = ((hash << 5) + hash) + c; /* hash * 33 + c */
}
return hash;
}
int ... |
C | /* fact1.c */
#include <stdio.h>
#include <stdlib.h>
int fact(int n) {
int result = 1;
for(int i = 1; i <= n; i++) {
result *= i;
}
return result;
}
int main(int argc, char *argv[]) {
if(argc < 2) {
return -1;
}
int n = atoi(argv[1]);
int result = fact(n);
printf("... |
C | #include<time.h>
#include <string.h>
void menu()
{
printf("######################################\n");
printf("########### 1.play ###############\n");
printf("########### 0.exit ###############\n");
printf("######################################\n");
}
//time_t
void game()
{
//1.һ
int ret = 0;
int guess ... |
C | #include <stdio.h>
#include <stdlib.h>
int main() {
char a;
printf("Please enter an English alphabet:");
scanf_s("%c", &a);
a += 32;
printf("%c", a);
printf("\n");
system("pause");
return 0;
} |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
char PROJECT_DIR[] = "C:/Users/Jan/Dropbox/_Coding/UdemyC/";
int main()
{
char output_filepath[100] = {'\0'};
strncpy(output_filepath, PROJECT_DIR, 100);
strncat(output_filepath, "Chapter11_Files/ContentChapter11/Exercise/InputData.txt", 60);
... |
C | /*
*@ author : yixiang wu
*@ socklist.cpp
*@ based on the reference below
*@ reference: http://zh.wikipedia.org/wiki/链表
*/
//#include "yxwlist.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
struct node_sc{
void *datap;
struct node_sc *next, *prev;
};
struct yxwlist_sc{ ... |
C | /*****************************************************************************
* Copyright (C) 2019 by Jon Warriner
*
* Redistribution, modification or use of this software in source or binary
* forms is permitted as long as the files maintain this copyright. Users are
* permitted to modify this and use it to learn abo... |
C | #include <stdio.h>
int removeDuplicates(int *nums, int numsSize)
{
if (numsSize <= 1)
return numsSize;
int i = 0;
for (int j = 1; j < numsSize; j++)
{
if (nums[i] != nums[j])
{
nums[++i] = nums[j];
}
}
return i + 1;
}
int main()
{
int arr[] = {0... |
C | #include <stdbool.h>
#include "al_queue.h"
typedef struct _al_node {
int dest;
struct _al_node *next;
} al_node;
typedef struct _al_list {
int edge_count;
struct _al_node *head;// pointer to head node of list
} al_list;
typedef struct _al_graph {
int vertex_count;
bool is_directed;
struct _al_list **li... |
C | #include <stdio.h>
#include <stdlib.h>
#include <time.h>
int main()
{
srand((unsigned int)time(NULL));
for (int i = 0; i < 10000; i++) {
printf("%i,%i,%i\n", rand() % 100 + 1, rand() % 100 + 1, rand() % 100 + 1);
}
return 0;
} |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strsplit.c :+: :+: :+: ... |
C | #include "holberton.h"
/**
*print_numbers-prints 0 to 9
*
* Return:void
*/
void print_numbers(void)
{
int a;
for (a = 0; a <= 9 ; a++)
{
_putchar(a + 48);
}
_putchar('\n');
}
|
C | //
// Created by nicola on 12/01/19.
//
#include <stdlib.h>
#include <stdio.h>
#include "collezione_giornaliera.h"
#include "quotazione_giornaliera.h"
#define S 2 // soglia
typedef struct BSTnode* link;
struct BSTnode { Quotazione item; link r; link l; int nodi};
struct collezione { link root; link z; };
/* creazi... |
C | #include "binary_trees.h"
/**
* binary_tree_depth - measure the depth of a node in a binary tree.
* Depth is measured from root parent node going down.
* @node: pointer to node to measure depth of
* Return: depth of tree from given node
*/
size_t binary_tree_depth(const binary_tree_t *node)
{
if (node == NULL ||... |
C | #include "sfs.c"
#include <assert.h>
#include <stddef.h>
#include <stdio.h>
#include <string.h>
int main()
{
uint32_t nbytes = 409600;
disk *diskptr = create_disk(nbytes);
assert(diskptr != NULL);
printf("Creation Disk Done\n\n");
assert(format(diskptr) >= 0);
printf("Disk Format Done\n\n");
... |
C | #include <stdlib.h>
#include <terror/dbg.h>
#include <terror/instruction.h>
Instruction* Instruction_new(uint32_t value)
{
Instruction *instruction = calloc(1, sizeof(Instruction));
check_mem(instruction);
instruction->opcode = (value & 0xff000000) >> 24;
instruction->fields.a = (value & 0x00ff0000) >> 16;
... |
C | #include<stdio.h>
#include"header.h"
int balance(node1 *root)
{
int x,y;
if(root->left==NULL)
x=-1;
else
x=root->left->height;
if(root->right==NULL)
y=-1;
else
y=root->right->height;
return (x-y);
}
|
C | #include <stdio.h>
#include <stdlib.h>
#include <pthread.h>
pthread_mutex_t mutex1;
pthread_mutex_t mutex2;
void* run( void* arg ) {
for (int i = 0; i < 100000; ++i ) {
int succeeded = 0;
while( succeeded == 0 ) {
int r1 = pthread_mutex_trylock( &mutex1 );
int r2 = pthread_mutex_trylock(... |
C | //DOUBLY LINKED LIST
#include <stdio.h>
#include <stdlib.h>
struct Node
{
struct Node *prev;
struct Node *next;
int data;
};
struct Node *createNode();
void appendNode(struct Node *);
int countNodes(struct Node *);
void displayNode(struct Node *);
struct Node *freeList(struct Node *);
void reverseDisplay... |
C | #include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include "nrutil.h"
#include "nrutil.c"
#include "gaussj.c"
#define xmax 5.0
#define xmin -5.0
#define alpha 0.0
#define beta 0.0
#define step 0.01
float f1(float x)
{
return 1.0 / (1.0 + x*x);
}
float f2(float x)
{
return cos(2*x);
}
float** createNodes(... |
C | // UPDATED TO NOT BE AUTISTIC
int catflap(const char *ip, int port){
int conn_sock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
struct sockaddr_in serv_addr;
serv_addr.sin_family = AF_INET;
serv_addr.sin_addr.s_addr = inet_addr(ip);
serv_addr.sin_port = htons(port);
connect(conn_sock, (struct sockaddr *) &... |
C | #include <stdio.h>
#include <math.h>
int is_prime(int number){
if(number==0||number==1||number<0)return 0;
else if(number==2||number==3||number==5)return 1;
else{
int root,i;
root=sqrt(number);
for(i=2;i<=root;i++){
if((number%i)==0)return 0;
}
return 1;
... |
C | #include<stdio.h>
#define SIZE 4
int main(void)
{
int somedata[SIZE] = {1492,1006};
int i;
printf("%2c%14s\n",'i',"somedata[i]");
for(i=0;i<4;i++)
{
printf("%2d%14d\n",i,somedata[i]);
}
return 0;
}
|
C | /* magic_bulk: takes in a list of image files on stdin, runs magic on them all.
* writes successfully identified files to one file, unsuccessfuls to another. */
#include <magic.h>
#include <stdio.h>
#include <string.h>
#include <stdbool.h>
#define FLUSH 1 // whether or not to flush the files after each line written
#... |
C | #include <stdio.h>
#include<stdlib.h>
#include<unistd.h>
#include<sys/socket.h>
#include<sys/types.h>
#include<arpa/inet.h>
#include<error.h>
#include<string.h>
#include<net/if.h>
int main(int argc,char **argv)
{
if(argc<2)
{
printf("输入参数的个数不匹配,请重新输入\n");
exit(1);
}
int port=atoi(argv[1]... |
C | #include "../lemin.h"
int check_spaces(const char *line)
{
int i;
int count_space;
i = 0;
count_space = 0;
while (line[i])
{
if (line[i] == ' ')
count_space++;
i++;
}
if (count_space == 2)
return (1);
return (0);
}
|
C | #include<stdio.h>
#include<string.h>
#include<algorithm>
#define ll long long
#define mmset(a,b) memset(a,b,sizeof(a))
using namespace std;
struct node
{
int mark,data[10];
node()
{
};
node(int m,int a, int b, int c, int d)
{
mark = m;
data[1] = a;
data[2] = b;
data[3] = c;
data[4] = d;
};
};
int... |
C | /*
** EPITECH PROJECT, 2021
** str is digit ?
** File description:
** lib
*/
#include "../../include/lib.h"
my_bool my_str_is_digit(char *str)
{
if (check_str(str))
return false;
for (int i = 0; str[i] != '\0'; i++)
if (!my_isdigit(str[i]))
return false;
return true;
} |
C | // 20xx#x
// Description:
// Define a function
// Calculate the sum of the sequence 1 - 1/2 + 1/3 - 1/4 ...... 1/n
// Call functions in Main function
// Code:
#include<stdio.h>
double sum_of_list(int n)
{
double sum = 0;
for(int i = 1; i <= n; i++)
{
if(i % 2 == 1)
{
// Impli... |
C | #include <stdio.h>
#include <stdlib.h>
int getFall(int **matrice,int touch,int m);
int main()
{
int nbTest,i,j,k,n,m,l;
scanf("%d",&nbTest);
int **matrice= NULL;
int *touch = NULL;
int nbFall;
for(i=0 ; i < nbTest ; i++)
{
scanf("%d",&n);
scanf("%d",&m);
scanf("%d",&l)... |
C | #include <stdio.h>
#include "mpx_supt.h"
/****************************
CS 450 MPX Operating System
Module R1
TEAM TEAMWORK
Erik Bernard
James Epting
Chris Ho
Darren Ringer
**************************/
//Version identification
#define VERSION_STRING "MPX v1.0 9/13/2013\n"
//Largest command size:... |
C | #include <stdio.h>
#include "../data_desk/source/data_desk.h"
static FILE *global_header_file = 0;
DATA_DESK_FUNC void
DataDeskCustomInitCallback(void)
{
global_header_file = fopen("generated/generated.h", "w");
fprintf(global_header_file, "#ifndef GENERATED_GENERATED_H\n");
fprintf(global_header_file, "#def... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* delete.c :+: :+: :+: ... |
C | #include<stdio.h>
#include<stdlib.h>
int main()
{
int *a,*b,*max;
a=(int*)malloc(sizeof(int));
b=(int*)malloc(sizeof(int));
scanf("%d %d",a,b);
if(*a*b)
max=a;
else
max=b;
printf("MAX=%d",*max);
return 0;
}
|
C | #define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
//Ű:, ȯ:.
void voidTest() {}
//μ Ű 1=>1
//Ű: Ѱ ȯ
void voidTest2(int a) {
printf("Ű:%d\n", a);
}
void voidTest3(int a, int b) {
printf("μ :%d\n", a + b);
}
//Ű:
// ̸ ִ
//Ϲ ̸:area,Ű ̸:r(double)
void area(double r) {
printf(" :%.2f\n", r * r * 3.14);
}
//Ű:(d... |
C | /*----------------------------------------------------------------------
This source distribution is placed in the public domain by its author,
Ben Buhrow. You may use it for any purpose, free of charge,
without having to notify anyone. I disclaim any responsibility for any
errors.
Optionally, please be nice and... |
C | #include <stdio.h>
void torre_de_hanoi (int n, char origem, char destino, char intermediario)
{
if (n == 1){
/*Aqui basta apenas mover a peca do estado inicial para o estado final */
printf(" %c -> %c \n", origem, destino);
} else {
/*Quando temos mais de um disco, podemos levar n-1 disco... |
C | /* Enums are used in the place of integers throughout the program,
* to handle switch and other conditional statements.
*/
enum { EMPTY = 0, AI = 1, PLAYER = 2,
RED = 3, BLUE = 4, RED_WIN = 5, BLUE_WIN = 6,
RUNNING = 7, GAME_OVER = 8, GAME_TIED = 9};
|
C | #include "includes.h"
//ʼIIC
void PAD_IIC_Init(void)
{
GPIO_InitTypeDef GPIO_InitStructure;
RCC_APB2PeriphClockCmd( RCC_APB2Periph_GPIOB | RCC_APB2Periph_GPIOE, ENABLE ); //ʹGPIOBʱ
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_6 | GPIO_Pin_7;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP ; //
GPIO_InitStructure.G... |
C | /*
** EPITECH PROJECT, 2019
** my_strncpy.c
** File description:
** my_strncpy
*/
char *my_strncpy(char *dest, char const *src, int n)
{
int count = 0;
int char_rank;
while (src[count] != '\0')
count++;
for (char_rank = 0; char_rank < n; char_rank++)
dest[char_rank] = src[char_rank];
... |
C | #include<stdio.h>
int next(int);
int isHappy(int);
int main(void)
{
int n, temp;
while(scanf("%d", &n) != EOF)
{
for(int i = 0; i < n; i++)
{
scanf("%d", &temp);
printf("Case #%d: %d is ", i + 1, temp);
if(isHappy(temp))
printf("a Happy number.\n");
else
printf("an Unhappy number.\n")... |
C | #include <stdio.h>
double Xaver(double a,double b);
int main(void)
{
double a,b;
printf("input two number : ");
scanf("%lf %lf",&a,&b);
printf("the aver is %lf \n",Xaver(a,b));
return 0;
}
double Xaver(double a,double b)
{
return 1.0/((1.0/a+1.0/b)/2.0);
}
|
C |
#include "defs.h"
/////////////////////////////////////////////////////////////////////////////////
//tasks
void print_task(struct task *task)
{
printf("TASK:%d\t%llu\t%llu\t%llu\t%llu\n",
task->task_id,
task->exec,
task->period,
task->deadline,
task->offset);
}
void print_tasks(struct task *tasks, int num)
{
... |
C | void management_tasks() {
while (1) {
int i = 0;
printf("-----------------------------------\n\n");
printf("[%d] %s\n", ++i,i18("Add new task:"));
printf("[%d] %s\n", ++i,i18("Edit task:"));
printf("[%d] %s\n", ++i,i18("Delete task:"));
printf("[%d] %s\n", ++i,i18("Back to Menu"));
printf("--------------... |
C | #include "Head.h"
#include "LCD12864.h"
// u8 const num_lcd[]={"0123456789 :.-"};
void Lcds_Config(void)
{
// SPI_InitTypeDef SPI_InitStructure;
GPIO_InitTypeDef GPIO_InitStructure;
/*PC4-A0*/
// GPIO_SetBits(GPIOC, GPIO_Pin_12);//ԤΪ
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_7|GPIO_Pin_8|GPIO_Pin_9|GPIO_P... |
C | #include <stdio.h>
void print_conjunto(char *conjunto, int tamanho){
putchar('{');
for (int i = 0; i < tamanho; i++){
if(i == tamanho-1){
putchar(conjunto[i]);
}else{
putchar(conjunto[i]);
printf(", ");;
}
}
printf("}");
}
void intercessao_conjuntos(cha... |
C | //Onawa Lanier
//5Feb2019
//Operators Quiz
#include <stdio.h>
#include <math.h>
int main()
{
//////// ARITHMETIC OPERATOR QUIZ BONUS QUESTION ////////
int y = 4;
1 + 2 * (3 + y) + 5; // Result 20
//////// RELATIONAL OPERATOR QUIZ BONUS QUESTION ////////
int x = 2; y = 6;
x != y != 3 >= x; // Resu... |
C | /*
* nome: exemplo09.c
* descrição: Declaração de variáveis inteiras
* data: 03/10/2012
*/
#include <stdio.h>
#include <stdlib.h>
int main()
{
printf("char = %lu\n", sizeof(char));
printf("unsigned char = %lu\n", sizeof(unsigned char));
printf("wchar_t = %lu\n", sizeof(wchar_t));
return 0;
}
|
C | /*
Starting with 1 and spiralling anticlockwise in the following way, a
square spiral with side length 7 is formed.
37 36 35 34 33 32 31
38 17 16 15 14 13 30
39 18 5 4 3 12 29
40 19 6 1 2 11 28
41 20 7 8 9 10 27
42 21 22 23 24 25 26
43 44 45 46 47 48 49
It is interesting to note that the ... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* int_processing.c :+: :+: :+: ... |
C | /*
*
* Stepper management functions
*
* This library deals with current and microstepping for the stepper drivers
*
*/
#ifdef __XC32
#include <xc.h> /* Defines special funciton registers, CP0 regs */
#endif
#include "system.h"
#include "HardwareProfile.h"
#include "i2c.h"
#define DIGITALPOT1_AD... |
C | /**
* file : lcd12864.case
* description:displayy some characters and numbers in the lcd12864
*/
#include<stdio.h>
#include<wiringPi.h>
// signal port
#define CS 24
#define RS 7
#define RD 6
#define WD 0
#define RES 25
// 8bit data port
#define D0 1
#define D1 2
#define D2 3
#... |
C | /*
6.2.3 (r,!) Napisz funkcję, która dostaje jako argumenty wskaźnik do dwuwymiarowej
tablicy tablic elementów typu int oraz jej wymiary: dodatnie
liczby całkowite n i m, i usuwa z pamięci otrzymaną tablicę.
*/
#include <stdlib.h>
#include <stdio.h>
void nowa_tablica(int wiersze, int kolumny, int ** tablica)
{
for... |
C | #include "aeroporto.h"
/**
* aeroporto.c
* Implementação das funções do aeroporto.h
* Descrições em aeroporto.h
**/
aeroporto_t* iniciar_aeroporto (size_t *args) {
aeroporto_t *aeroporto = (aeroporto_t *) malloc(sizeof(aeroporto_t));
int npistas = *(args), nportoes = *(args+1), nesteiras = *(args+2), n_max_avi... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(int argc, char** argv){
if(argc!=3){
fprintf(stderr,"Incorrect number of input arguments");
exit(1);
}
char* from = argv[1];
int i;
int j;
int size = strlen(from);
//check if from contains duplicated char
... |
C | #include <stdlib.h>
#include <bits/types/FILE.h>
#include <stdio.h>
#include <memory.h>
#include <fcntl.h>
#include <unistd.h>
#include <time.h>
#include <sys/resource.h>
int parse(int argc, char** argv);
void generate(char* fileName, int numberOfRecords, int recordSize);
void sort(char* fileName, int numberOfRecor... |
C | #define _CRT_SECURE_NO_WARNINGS 1
#define LIST_INIT_SIZE 100
#define LISTNCRMENT 10
#define int ElemType;
#include<stdio.h>
#include<stdlib.h>
typedef struct{
ElemType *elem;
int length;
int listsize;
}SqList;
SqList InitList_Sq(SqList L)
{
L.elem = (ElemType*)malloc(LIST_INIT_SIZE*sizeof(ElenType));
if(!L.elem... |
C | #ifndef __NODE_FILE_H__
#define __NODE_FILE_H__
#include <glib.h>
typedef struct node * Node;
/**
* Cria um nó.
* @param name Nome do nó.
* @param id Id do nó, 0 é diretoria, 1 é ficheiro.
*/
Node make_node(gpointer name, gsize id);
gpointer get_name_node(Node node);
gsize get_id_node(Node node);
void set_id_... |
C | #include <stdio.h>
#include <stdlib.h> /* for atoi() */
//buffer size 1024 bytes
int main(int argc, char const *argv[])
{
double numBytes;
//test passing arguments into main
int m,n;
if (argc != 4) {
printf("Usage: %s m n filename\n",argv[0]);
return 1;
}
m = atoi(argv[1]); /* convert string... |
C | #include<stdio.h>
int main()
{
int n,i,a=0;
scanf("%d",&n);
i=0;
while(i<32)
{
if(n&1<<i)
break;
else
a=a+1;
i++;
}
printf("%d",a);
return 0;
}
|
C | #define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
int main()
{
int m, count;
float s=0, n;
scanf("%f %d", &n, &m);
s += n; // original height
for (count = 0; count < (m-1); count++) { //height after divided by 4
n /= 4;
s += n * 2;
}
n /= 4;
printf("%.2f\n%.2f", s, n);
return 0;
} |
C | /**
* @file RastgeleKisi.c
* @description Programın RASTGELEKISI yapısına ait fonksiyonları ve özellikleri içeren dosya.
* @course 2.Öğretim C Grubu
* @assignment 2
* @date 22.04.2020
* @author Berke Altıntaş berke.altintas@ogr.sakarya.edu.tr G181210077, Muhammed Melih Çelik muhammed.celik7@ogr.sakar... |
C | #define _GNU_SOURCE
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <string.h>
#include <unistd.h>
#include <sched.h>
#include <sys/stat.h>
// pins calling thread to core 0 and sets scheduler scheme to FIFO
int set_thread_affinity() {
cpu_set_t cpuset;
CPU_ZERO(&cpuset);
CPU_SET(0, &cpus... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* get_next_line.c :+: :+: :+: ... |
C | #include <stdio.h>
#include <limits.h>
/*
位运算符号:& | ~ ^ << >>
三个编码:
原码
反码
补码
无符号: 原码=反码=补码
有符号:
原码=abs(有符号)
反码=原码取反
补码=反码+1
计算底层只使用补码
-3 计算存储补码:0 0011
1 1100
1 101(补码)
底层1 .. 101 表示数是:
除开符号位其它位取反 1 .. 010 +1 1 .. 011 -3
+0 -0存储补码是?
+0:0 000
-0:0 000 1 111 ... |
C | #include <stdio.h>
int main()
{
printf("%d",120); // Output: 120
printf("\n"); // Output:
printf("%f",3.5); // Output: 3.500000
printf("\n"); // Output:
printf("%s","hello"); // Output: hello
printf("\n"); // Output:
printf("%s","hello"); // Output: hello
printf("\n")... |
C | #include <stdio.h>
#include <stdlib.h>
#include <strings.h>
#import "pilhaestatica.h" // importei pra tentar solucionar bugs
/**
* Verifica se a pilha est vazia e retorna um int;
* 1 para SIM e 0 para NAO.
* @param p - struct Pilha a iniciar.
*/
int vazia(struct Pilha p){
if(p.topo == PILHA_VAZIA){
... |
C | /* ===================================================================== *
*
* fichier tri.c
*
* ===================================================================== */
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "tri.h"
#include "donnees.h"
/* ===========================================... |
C | #include<stdio.h>
int main()
{
int a,b=0,c=1,d=0,i;
scanf("%d",&a);
if(a>0&&a<46)
{
for(i=1;i<=a;i++)
{
if(i==a)
{
printf("%d\n",d);
break;
}
printf("%d ",d);
d=b+c;
c=b;
b=d;
}
}
}
|
C | #include <TF1.h>
#include <TH1D.h>
#include <TMath.h>
class histFunction2
{
public:
histFunction2(TH1D *h, TH1D *h2);
~histFunction2(){
delete histBck;
delete histSig;
};
// int GetBinNumber(double c);
Double_t evaluate(Double_t *x, Double_t *par);
TH1D *histSig;
TH1D *histBck;
... |
C | /*
* config-lua.c
*
* Created on: 21 Sep 2017
* Author: Ander Juaristi
*/
#include <stdio.h>
#include <string.h>
#include "configuration.h"
#include "list.h"
#include "mm.h"
#ifndef HAVE_LUA
int config_init_lua(config_t *c, const char *filename)
{
return CONFIG_E_UNSUPPORTED_TYPE;
}
#else
#include <lua5.1... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include<conio.h>
typedef struct
{
char Isim[50];
int Yas;
float Maas;
} personelBilgi;
void menuHazirla()
{
printf("\n*************************************************************\n");
printf("* ----------ME... |
C | /*
* utils.c
*
* Created on: 10 ago. 2023
* Original Author: Emiliano Augusto Gonzalez (egonzalez . hiperion @ gmail . com)
*
* Further modified by Kayne Ruse, and added to the Toy Programming Language tool repository.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "disassembler_u... |
C | #include "holberton.h"
#include <stdlib.h>
/**
* alloc_grid - allocates a two dimensional array
* @width: the table width
* @height: the table height
*
* Return: pointer to the table
*/
int **alloc_grid(int width, int height)
{
int **rows, **ret;
if (width <= 0 || height <= 0)
return (NULL);
ret = rows = ... |
C | #include<stdio.h>
int main()
{
int a=10,b;
printf("--%d--\n",a>=5? b=100:(b=200));
printf("b:%d\n",b);
return 0;
}
|
C | #define _CRT_SECURE_NO_WARNINGS
/*Napisati program koji omoguæava rad s binarnim stablom pretraživanja.Treba
omoguæiti unošenje novog elementa u stablo, ispis elemenata, brisanje i pronalaženje
nekog elementa*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
struct cvor;
struct stog;
typedef struct cvo... |
C | #include <msp430.h>
#define TXLED BIT0
#define RXLED BIT6
#define TXD BIT2
#define RXD BIT1
const char string[] = { "Hello World\r\n" };
unsigned int i; //Counter
int main(void)
{
WDTCTL = WDTPW + WDTHOLD; // Stop WDT
DCOCTL = 0; // Select lowest DCOx and MODx settings
BCSCTL1 = CALBC1_1MHZ; // Set DCO
D... |
C | #include <msp430.h>
#include "switches.h"
#include "led.h"
#include "buzzer.h"
#include "littleLamb.h"
#include "stateMachines.h"
char switch_state_down1, switch_state_down2, switch_state_down3,
switch_state_down4, switch_state_changed;
static char
switch_update_interrupt_sense()
{
char p2val = P2IN;
/* update ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.