language large_stringclasses 1
value | text stringlengths 9 2.95M |
|---|---|
C | /*
Danilo Arthur Bertelli
Reaction Game using Timer2 (8-bits)
We can count up to 255 so if we preload the counter with 130, this leaves 125 cycles left to count.
To reach the 255 value at the Arduino 16Mhz clock speed, gives us 1ms each overflow.
*/
#include <stdio.h>
#include <stdlib.h>
#include <avr/... |
C | /*
* Luke Craig
* 4/30/2021
* GPLv3
*/
#define _GNU_SOURCE
/*
* Without this there's no register definitions.
* I was going to make it open source, but I guess it *must* be GPL
* to get the register definitions.
*/
#include <stdlib.h>
#include <signal.h>
#include <string.h>
#include <stdio.h>
#include <unistd.h>
#i... |
C | // alltoall implementado con send y recv, auqnue de momento solo funciona para 3
// procesos solamente.
#include <stdio.h>
#include <string.h>
#include </usr/include/mpi/mpi.h>
int main(int argc, char **argv){
int my_rank, nproc;
char message;
MPI_Status status;
MPI_Init(&argc, &argv);
MPI_C... |
C | /*
* Fortran interfaces to some POSIX I/O routines.
* In case you want to avoid the record markers.
*
* FO 02/2013
*/
#if (F2C_STYLE == 1)
# define C_OPEN c_open
# define C_CLOSE c_close
# define C_WRITE_AT c_write_at
#elif (F2C_STYLE == 2)
# define C_OPEN C_OPEN
# define C_CLOSE C_CLOSE
# define C_... |
C | #include <stdio.h>
#include "holberton.h"
/**
* _pow_recursion - a functino that returns the power of x to the y
* @x: the base
* @y: the power
* Return: the result
*/
int _pow_recursion(int x, int y)
{
if (y > 0)
return(x * _pow_recursion(x, y - 1));
else if (y < 0)
return (-1);
else
return (1);
}
|
C | #include<stdio.h>
main()
{
char a[100],b[100],c[100];
int i;
gets(a);
gets(b);
for(i=0;i<=2;i++)
c[i]=a[i]*b[i];
puts(c);
for(i=0;i<=4;i++)
printf("%d",a[i]);
getch();
}
|
C | #define _GNU_SOURCE
#include "../output.h"
#include "../keys.h"
#include "../network.h"
#include "ordered_set.h"
#include <fcntl.h>
#include <sys/inotify.h>
#include <sys/stat.h>
#define TERR(...)
//DEBUG(__VA_ARGS__)
// Initialize the given ordered set object.
// mode -> OSET_READ or OSET_WRITE
// path -> Requi... |
C | #include "graph.h"
#include "judge.h"
void mineNotify(graph_t *graph, int v) {
/*Notify the adjacent cell of a mine that the cell v contains a mine*/
adjlist_node_p parent = graph->adjListArr[v].head;
while (parent != NULL) {
adjlist_node_p child = graph->adjListArr[parent->vertex].head;
w... |
C | // ADCTestmain.c
// Runs on LM4F120/TM4C123
// Provide a function that initializes Timer0A to trigger ADC
// SS3 conversions and request an interrupt when the conversion
// is complete.
/*
List three ways you could use to initiate the ADC conversion process.
1. Triggered by the processor
2. Analog comparator
... |
C | #include "Synchronization.h"
#include "Utility.h"
#include "Task.h"
#include "AssemblyUtility.h"
// 스핀락 도입 이전에 사용하던 함수들
#if 0
// 시스템 전역에서 사용하는 데이터를 위한 잠금 함수
BOOL kLockForSystemData(void)
{
return kSetInterruptFlag(FALSE);
}
// 시스템 전역에서 사용하는 데이터를 위한 해제 함수
void kUnlockForSystemData(BOOL bInterruptFlag)
{
kSetInte... |
C | #include<stdio.h>
main()
{
int n;
printf("Enter any number between 1 to 5:\n1. Pizza, Rs 239\n2. Burger, Rs 129\n3. Pasta, Rs 179\n4. French Fries, Rs 99\n5. Sandwich, Rs 149\n");
scanf("%d",&n);
switch(n)
{
case 1:
printf("Food item- pizza\nPrice- Rs239");
break;
case 2:
printf("Food item... |
C | /*Write a complete program to create, display, insert and delete node of
a doubly linked list.
*/
#include<stdio.h>
#include<stdlib.h>
#include<stdbool.h>
//Declaring the structure
struct node{
struct node *prev;
int value;
struct node *next;
};
//Global variables
struct node *start, *previous;
int num; ... |
C | #ifndef AQW
#define AQW
extern vu32 vu32Tick;
extern vu16 Delay_Cnt;
/*static*/ ui32 BIOS::GetTick()
{
return vu32Tick;
}
/*static*/ void BIOS::DelayMs(unsigned short ms)
{
Delay_Cnt = ms;
while (Delay_Cnt > 0){}
}
/*static*/ void BIOS::Init()
{
DelayMs(500);
LCD::Init();
ADC::Init();
}
char ttp[8]; // ... |
C | #include "holberton.h"
#include <stdlib.h>
#include <ctype.h>
/**
* main - return 1 if thestrings have the number one
* @argc: number
* @argv: Pointer array
*
* Return: 0 to success
*/
int main(int argc, char *argv[])
{
int i, j, add;
add = 0;
for (i = 1; i < argc; i++)
{
for (j = 0; *(*(argv + i) + j) ... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* tools.c :+: :+: :+: ... |
C | //
// ) ʸ Է¹ް, ʷ ϼ.
// ) 3 Է¹ް, հ غ.
// ) ϳ Է¹ް "¦""Ȧ" غ.
// ) 0~99 ϳ Է¹ް 60̸̻ \"հ\"60 ̸̸ \"հ\" غ.
// ) 0~9 Ȧ
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
// ) int score[10] = {10, 100, 90, 80, 49, 30, 64, 38, 0, 20};
// ε 2 л غ.
// ü 50 ̻ غ.
// 100 л ε ... |
C | #include<stdio.h>
#include<stdlib.h>
struct BSTNode {
int data;
struct node *left;
struct node *right;
};
int isBstHelper(struct BSTNode *node,int min, int max) {
//empty tree is always a BST
if(node == NULL)
return 1;
if(node->data < min || node->data > max)
return 0;
return isBstHelper((struct BSTNode *)... |
C | #ifndef LEVI_CIVITA_HH
#define LEVI_CIVITA_HH
// author: Jonas Rademacker (Jonas.Rademacker@bristol.ac.uk)
// status: Mon 9 Feb 2009 19:18:13 GMT
#include "Mint/LorentzMatrix.h"
#include "Mint/Utils.h"
#include "TLorentzVector.h"
#include "TMatrixT.h"
//#include <iostream>
inline double LeviCivita(const TLorentzVect... |
C | /*
* caeser.h
*
* Created on: 06.12.2014
* Author: torbenhaug
*/
#ifndef SRC_CAESER_H_
#define SRC_CAESER_H_
#define NELEMS(x) ((sizeof(x) / sizeof(x[0])-1))
/**
* Char de-/encrypter.
* This function will move one char on the filetable by a given number.
* The chars have to be in the following rang... |
C | /*
* 首先,需要一个day存放输入的天数
* 并且需要一个week在后面用于存放周数
* 然后,利用while循环不断输出对应的周数+天数
* 循环的判断条件应该用一个flag来判断
* 跳出循环
*/
#include <stdio.h>
const short STEP = 10;
const short D_PER_W = 7; // 天/周
int main(void)
{
int day = 0;
unsigned short week = 0;
unsigned short count = 1;
printf("*****************************... |
C | #include <stdio.h>
#include <stdlib.h>
#include "structs.h"
void vec_write_output(char path[256], struct vec *vectors, struct vec *centers, int vec_sum, int k, int vec_upd, double *s, int coords, time_t time){
int i, j, *size;
double *s_cluster, s_total;
FILE *fp;
fp = fopen(path, "w");
size = malloc(k*sizeof... |
C | #ifndef STACK_ELEMENT_H
#define STACK_ELEMENT_H
#include "element.h"
#include <stdio.h>
#define MAXSTACK 100
typedef struct _Stack Stack;
/**------------------------------------------------------------------
Inicializa la pila reservando memoria. Salida: NULL si ha habido error o la pila si ha id... |
C | /*
Author: Jiri Kalina
Purpose: Udemy - C Programming For Beginners, 49.switch
Title: 49_swithc_statm.c
Date: 29.12.2020-12:00:14
*/
#include <stdio.h>
int main()
{
enum weekday {Mon, Tue, Wed, Thu, Fri, Sat, Sun};
enum weekday today = Wed;
switch(today)
{
case Sun:
printf("Today ... |
C | #include<stdio.h>
int max (int a [], int length) {
if (length==2){
if (a[0]>=a[1])
return a[0];
else
return a[1];
}
else {
int max_before = max(a,length-1);
if (a[length-1]>=max_before)
return a[length-1];
else
return m... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* get_next_line_utils.c :+: :+: :+: ... |
C | #include <stdio.h>
#include <stdlib.h>
void fibbonaci(int wyraz);
int main()
{
int ktory;
printf("powiedz ktory wyraz chcesz wyliczyc:\n");
while((scanf("%d",&ktory))==1)
{
fibbonaci(ktory);
printf("podaj kolejny numer wyrazu\n");
}
printf("Hello world!\n");
return 0;
}
void... |
C | #include <stdio.h>
#include <emgr.h>
void test(int);
void check_on_test();
int main() {
check_on_test();
// printf("Returned from test: %d\n", emgr_is_ok(&emgr_struct));
return 0;
};
void check_on_test() {
test(2);
RET_ON_PREV_ERROR;
printf("HUHASD UHASD ");
};
void test(int i){
if (i == 1) {
... |
C | #include <stdio.h>
#include <string.h>
#include <stdlib.h>
char* strrev(char*);
int main(int argc, char *argv[])
{
int t,i=0,temp=0;
char *str[10],*rev[10];
scanf("%d",&t); //input the number of test cases
while(i<t)
{
scanf("%s",str[i]);
i++;
}... |
C | #include "player.h"
#include <stdlib.h>
struct player_t {
int score;
int num_wins;
int num_loses;
int num_draws;
int play_time;
int number_of_plays;
};
void* copyPlayer(void* player)
{
if (player == NULL) {
return NULL;
}
Player new_player = malloc(sizeof(*new_player));
if (!new_player) {
return NULL;... |
C | //客户端主程序
//发送需要计算的数据给服务器
//从服务器接收处理后的数据
#include "common.h"
int main(int argc, char **argv)
{
struct sockaddr_in serverAddr;
int clientfd;
char *server_host;
char buf[BUF_SIZE]; //标准输入读取缓存
int server_port;
int pid;
int pipefd[2];
if (argc != 3)
{
fprintf(stderr, "usage: %s <host> <port>\n", argv[0]);
... |
C | /** Read an intel hex file, take the reset vector (0) and put it into
* some other vector (argv[1]) and then put an rjmp to a given address.
*
* In other words, rewrite the reset vector so it points to a bootloader.
*
* Used for virtual boot with combined tiny tuner
*/
#include <stdlib.h>
#include <stdio.h... |
C | #include "../inc/kenken-solver.h"
int main(){
//printf("Main entered");
srand(time(NULL));
int t1 = (int) time(NULL);
int t2;
struct kenken test;
int onesol = 0;
int multsol = 0;
int nosol = 0;
int dmyarr[6][6];
int test2;
for(int i = 0; i < 10; i++){
//printf("pre gk entered\n");
generate_kenken(&test)... |
C | #include <stdio.h>
#include <graphics.h>
//creating a structure for input commands from the user
struct emp {
char w1[10]; //first string
char w2[10]; //second string
int a, b, c, d , x , y; //parameters of the figure
char w3[10]; // aditional color parameters
};
int main()
{
struct emp e;
int gd = DETECT, gm;... |
C | #include "kvclient.h"
int main(int argc, char **argv)
{
int sockfd;
int index;
const short NUM_HOSTS = 3;
int sockets[NUM_HOSTS], i;
unsigned char send_buf[BUF_SIZE], recv_buf[BUF_SIZE], *ptr;
struct addrinfo *servinfo;
char *hosts[3] = {"pi-host1", "pi-host2", "pi-host3"};
char operation[32];
char *command =... |
C | #include "ClientesMascotas.h"
void mostrarClientesConMascotas(eCliente listaCliente[], eMascota ListaMascota[], int tamCliete, int tamMascota)
{
for(int i = 0; i < tamCliete; i++)
{
if(listaCliente[i].estado == 1)
{
printf("\nCLIETNE:");
printf("\n\t NOMBRE| APELLI... |
C | /*
* @Andres Rogelio Cordoba
*
* This is the main implementation of the game Engine.
*/
#include "board.h"
#include "FreeRTOS.h"
#include "task.h"
#include "uart.h"
#include "KYPD.h"
#include "commonData.h"
#include "KYPD_Task.h"
pressedKey key;
/* Sets up system hardware */
static void prvSet... |
C | #include<stdio.h>
//找出三数最大值
int main(){
int a,b,c;
//依次输入三个待比较的数字
printf("请输入依次三个数:\n");
printf("a:");
scanf("%d",&a);
printf("b:");
scanf("%d",&b);
printf("c:");
scanf("%d",&c);
getchar();
printf("三个数依次是:%d,%d,%d\n",a,b,c);
//进行比较操作
int temp;
temp=(a>b?a:b);
... |
C | #include<stdio.h>
int main()
{
int a[20000],b[20000]={0},n,ans=0;
int i,j,k,min,min2,c,d;
freopen("guozi.txt","r",stdin);
freopen("ans.txt","w",stdout);
scanf("%d",&n);
for(i=0;i<n;i++)
scanf("%d",&a[i]);
for(d=0;d<n;d++)
{
min=ans;
for(j=0;j<n;j++)
{
if(b[j]==0)
... |
C | /* ************************************************************************
* Filename: 12_access.c
* Description:
* Version: 1.0
* Created: 2017年11月19日 14时33分24秒
* Revision: none
* Compiler: gcc
* Author: YOUR NAME (),
* Company:
* *****************... |
C | #include <sys/socket.h>
#include <sys/stat.h>
#include <stdio.h>
#include <netinet/in.h>
#include <netinet/ip.h>
#include <fcntl.h>
#include <unistd.h> // write
#include <string.h> // memset
#include <stdlib.h> // atoi
#include <stdbool.h> // true, false
#define BUFFER_SIZE 4096
struct httpObject {
/*
Cre... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_itoa_base.c :+: :+: :+: ... |
C | #include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/ipc.h>
#include <sys/sem.h>
#include <sys/shm.h>
#include <string.h>
#include <errno.h>
#include <fcntl.h>
int main(){
struct sembuf checker;
checker.sem_num = 0;//first one
checker.sem_flg = SEM_UNDO;
checker.sem_op = -1;
printf("N... |
C | #include <stdio.h>
#include <stdlib.h>
#include "globais.h"
#define MAXLINE 150
pnt * getPontos(char path[500]){
pnt * resp = NULL;
if(path != NULL){
FILE * arq = fopen(path, "r");
if(arq != NULL){
char buffer[MAXLINE];
do {
if (fgets(buffer, MAXLINE, arq) == NULL) {
printf("ERRO: ARQUIVO SEM INF... |
C | #include <stdio.h>
#include <stdlib.h>
#define MAX_SIZE 100
int A[MAX_SIZE];
int top = -1;
void push(int data){
A[++top] = data; return;
}
void pop(){
if(top == -1){
printf("The stack is already empty, nothing to remove\n");
return;
}
--top; return;
}
void viewTop(){
if(top == -1){
printf("S... |
C | /*******************************************/
/* main.c */
/* アスレチッククラブ会員管理プログラム */
/*******************************************/
#include <stdio.h>
#include <string.h>
#include "common.h"
#include "main.h"
#include "nyuukai.h"
#include "keisoku.h"
#include "sakujyo.h"
/**********... |
C | #include<stdio.h>
#define NAME_LEN 64
struct student {
char name[NAME_LEN];
int height;
float weight;
long schols;
};
int main(){
struct student takao={"Takao",173,86.2};
printf("姓名=%s add=%p\n", takao.name,&takao.name);
printf("身高=%d add=%p\n", takao.height,&takao.height);
printf("体重=%.1f ... |
C | #include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <time.h>
#define DEBUG
#include "sha1.h"
int generateSid(uint32_t *hash)
{
SHA1 sha;
char *str;
sha1Init(&sha);
//
// Insert 20 random bytes
//
srand(time(NULL));
for(int i = 0; i < 5; i++) {
int a = rand();
sha1AddBinary(&... |
C | #include <stdio.h>
#include <stdlib.h>
#include <dirent.h>
#include <ftw.h>
#include <time.h>
#include <string.h>
#include <unistd.h>
#define FTW_PHYS_TOCOS_NIEDZIALA 1
#define true 1
#define false 1
struct timeBeg
{
time_t base_time;
char comparing;
};
struct timeBeg bt = {0,5};;
static int fn(const ... |
C | #include <linux/doevent.h>
#include <linux/kernel.h>
#include <linux/sched.h>
struct doevent_list de_list;
void __init doevent_init() {
de_list.count = 0;
de_list.head = NULL;
//__SPIN_LOCK_UNLOCKED(de_list.lock);
spin_lock_init(&de_list.lock);
}
asmlinkage int sys_doeventopen()
{
//struct doev... |
C | #include "livelist.h"
#include "comdef.h"
#include "OSAL_Timers.h"
#include <string.h>
static tLiveList liveList;
void initLiveList(void)
{
memset(&liveList, 0, sizeof(tLiveList));
}
static bool insertLiveList(int index, uint8 * sn)
{
if (index >= MAX_END_NUM)
{
return false;
}
memcpy(liveList.... |
C | #include <stdio.h>
int main() {
char a[30] = { 0 };
int k, cnt = 0;
scanf("%s", a);
scanf("%d", &k);
for (int i = 0; a[i] != NULL; i++) {
for (int j = 1; j <= k; j++) {
printf("%c", a[i]);
}
}
} |
C | #include "simtbs.h"
/*
* bfa(Breadth First Allocation)
* schedule TB to be spreaded to SM
*/
static sm_t *
get_sm_by_bfa(unsigned *req_rscs)
{
sm_t *sm, *sm_min = NULL;
float usage_min = 0;
for (sm = get_first_sm(); sm != NULL; sm = get_next_sm(sm)) {
float usage;
if (!is_sm_resource_available(sm, req_rscs... |
C | /**************
Questao 02
Mailson Felipe
***************/
#include <stdio.h>
#include <string.h>
#include <stdbool.h>
bool checaPermutacaoParcial(char *palavra_01, char *palavra_02)
{
int letrasTrocadas = 0, i;
// Se o primeiro caracter da primeira palavra nao for igual ao primeiro caracter da segunda palavra,
... |
C | #ifndef GPR_IDLUT_H
#define GPR_IDLUT_H
#include "gpr_memory.h"
#include "gpr_array.h"
#include "gpr_buffer.h"
// -------------------------------------------------------------------------
// Id Lookup Table Container
// -------------------------------------------------------------------------
// Design & I... |
C | #include "bish.h"
/**
* _strlen - returns the len of a string
* @str: str we are getting len of
*
* Return: length of str
*/
int _strlen(char *str)
{
int i = 0;
while (str[i])
i++;
return (i);
}
|
C | #include<stdio.h>
void sort(int q[],int n){int temp;
for(int i=0;i<n;i++){
for(int j=0;j<n-i-1;j++){
if(q[j]>q[j+1]){
temp=q[j];
q[j]=q[j+1];
q[j+1]=temp;
}
}
}
}
int abs(int n){
if(n<0) return -1*n;
else return n;
} ;
void main(){
int q[10],end,head, n;
printf("\n Enter the initial hgead pos... |
C | //
// 9-2.c
// MyCStudy
//
//
#include <stdio.h>
int IsDigit(char a) {
if (a>=48 && a<=57) {
return 1;
}
else {
return 0;
}
}
|
C | #include <stdio.h>
#include <stdlib.h>
#include "main.h"
#include <time.h>
#include <windows.h>
#include "conio.h"
#include "ListeFonctions.h"
void afficherFleche(int indiceFleche)
{
gotoligcol(indiceFleche+3,18);
printf("->");
}
void pacmanAffichage()
{
/*for(int i = 0; i<255; i++)
... |
C | #include <ctype.h>
#include <stdlib.h>
#include <string.h>
int cmp(const void *a, const void *b)
{
char *s1 = *(char**)a;
char *s2 = *(char**)b;
char *as = strchr(s1, ' ') + 1, *bs = strchr(s2, ' ') + 1;
int r = strcmp(as, bs);
return r ? r : strcmp(s1, s2);
}
/**
* Note: The returned array must ... |
C | /**
* @file write.c
*
* @brief Write() system call.
*
* @authors Wee Loong Kuan <wkuan@andrew.cmu.edu>
* Chin Yang Oh <chinyano@andrew.cmu.edu>
* Jennifer Lee <jcl1@andrew.cmu.edu>
* @date 03 Nov 2013
*/
#include <types.h>
#include <bits/fileno.h>
#include <bits/errno.h>
#include <ex... |
C | #include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
// int open(const char *name, int flags);
// int open(const char *name, int flags, mode_t mode);
int main(void){
// 読み取り専用で開く
// int fd = open("/home/test01/aa", O_RDONLY | );
// 書き込み用にオープン. ファイルが存在しない場合はエラー(O_CREATが無いため)
int fd = open("/root/h... |
C | #include <stdio.h>
#include <stdlib.h>
#include "Racional.h"
struct Racional
{
int numerador;
int denominador;
};
Racional *cria_racional(int numerador, int denominador)
{
Racional *racional = (Racional *)malloc(sizeof(Racional));
if (racional == NULL)
{
printf("\nERRO: Memória insuficien... |
C | /**
* Copyright (C) 2017 Yuzhong Wen <supermartian@gmail.com>
*
* basehan: An algorithm that maps bytes to Chinese characters.
* What we use here is from U+4E00 ~ U+8E00, which maps to CJK character space.
*
* Distributed under terms of the MIT license.
*/
/*
* Algorithm in detail:
* 1. Take the input string ... |
C | /*
** EPITECH PROJECT, 2020
** error
** File description:
** error message
*/
#include "my.h"
int error_nb_matches(char *board, obj max, char *buff_line, char *buff_matches)
{
if (my_getnbr(buff_matches) > max.matches) {
my_printf("Error: you cannot remove more than %d matches per turn\n",
... |
C | /**
* Prints out the time of day.
*/
#include <stdio.h>
#include <unistd.h>
int main(void) {
printf("------------\n");
printf("Time of Day:\n");
printf("------------\n\n");
// __time
time_t seconds;
__time(&seconds, NULL);
int hour = ((int)seconds % 86600) / 3600;
int minute = ((int)seconds % 3600) / 60;
... |
C | #include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<pthread.h>
typedef int (*protocal_fun)(char *buf,int len);
struct protocal_call
{
protocal_fun p_fun;
char * key;
int type;
};
int main(int argc,void *argv[])
{
if(argc<2)
printf("please input mem size\n");
int mem_size= atoi(ar... |
C | #include <stdio.h>
#include <stdlib.h>
struct node {
int val;
struct node *next;
};
void binary_insert(struct node *num, int l, int *head_change)
{
int i;
for (i = 0; i < l - 1; i++)
if (num[i].val >= num[l - 1].val)
break;
if (i == 0) {
num[l - 2].next = NULL;
num[l - 1].next = num;
*... |
C | #include <avr/io.h>
int main()
{
DDRB |= (1<<0);//Set the P7 as the output pin
DDRC &= ~(1<<1);//Pin 1 of PORT C made as an input
ADMUX |= 1<<MUX0; //selecting the ADC input (ADC1 0001)
ADMUX &= ~(1<<MUX1 | 1<<MUX2 | 1<<MUX3);
ADMUX |= (1<<ADLAR); //left adugestment select
ADCSRA |= (1<<ADEN... |
C | /*************************************************
Copyright (C), 1994-2014 wangxin
File name: opposite
Author: wangxin Version: 1.0 Date: 2014.05.01
Description: 将一个字符串逆序
Others: no
Function List:
opposite_str(char *dest)
将一个字符串逆序
History: ... |
C | /* 1 - Global to Shared Transfer */
__device__
void __jacobiGlobalToSharedSRJ(const double * x0Gpu, const double * rhsGpu, const int subdomainLength_x, const int subdomainLength_y, const int nxGrids, const int nyGrids, const int OVERLAP_X, const int OVERLAP_Y)
{
/* Define shared memory */
extern __shared__ double sha... |
C | #include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <math.h>
#include "c_ga.h"
void print_complete(chromo *pool) {
static int id = 0;
char fileName[20];
FILE *fp;
sprintf(fileName, "output/%dpercent",id++);
fp = fopen(fileName, "w");
int i, j,fitness;
if (!fp) {
printf("Er... |
C | #include<stdio.h>
int main()
{
int a=0, i;
for (i=8;i<20;i++){
//if (i%2==0)
a++;
}
printf("%d",a);
}
|
C | double suma(double* arr, int* lenArr){
double aux = 0;
int i;
for(i = 0; i < (*lenArr); i++){
aux += arr[i];
}
return aux;
} |
C | /**
Reads in the data file
*/
#include "fitfunc.h"
#include "GLU_bswap.h"
// this is the reader for the rsq list ...
// if it fucks up we give RAW[0][0].NSAMPLES a value of -1 as the signalling error
struct resampled **
GLUdata( const char *filename , // filename (minus the number and .bin)
const int start , ... |
C | // ==============================================================================
/**
* mmu.c
*/
// ==============================================================================
// ==============================================================================
// INCLUDES
#include <assert.h>
#include <stdbool.h>
... |
C | /**@file client.c
*
* @brief A sample client program to demonstrate datagram service
*
* This client simply loads datagram service and sends one datagram to
* remote server
*
* @author Shrikant Mether (smether)
*/
#include "datagram.h"
int main(int argc, char *argv[])
{
int port, srvport, retval;
data... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* section_list.c :+: :+: :+: ... |
C | #include<stdio.h>
#include<math.h>
#define ESP 0.0001
#define F(x) 2*sin(3.142*x)+x
#define X(x) atanf(4*x)
#define G(x) 4/(1+(16*x*x))
void main()
{
float x1,x2,x;
int i=1;
do
{
printf("\nEnter the value of x: ");
scanf("%f",&x);
}while(fabs(G(x)) > 1);
x1=X(x);
printf("\n x = %f",x1);
printf("\n... |
C | #include<stdio.h>
int main(){
int T,n;
int a,i,j;
double h,rt = 1.414;
scanf("%d",&T);
for(i=0;i<T;i++){
scanf("%d",&a);
n=0;
while(a > 0){
//printf("%f %f %f %f\n", h, 2*h, 2*h-4, (2*h-4)/2);
if(a-2 > 0)
n+=(a-2)/2;
a-=2;
... |
C | #include "led_manager.h"
static void init_leds(void)
{
RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOD, ENABLE);
GPIO_PinAFConfig(GPIOD, GPIO_PinSource12, GPIO_AF_TIM4);
GPIO_PinAFConfig(GPIOD, GPIO_PinSource13, GPIO_AF_TIM4);
GPIO_PinAFConfig(GPIOD, GPIO_PinSource14, GPIO_AF_TIM4);
GPIO_PinAFConfig(G... |
C | /*
============================================================================
Name : rdparser.c
Author :
Version :
Copyright : Your copyright notice
Description : Hello World in C, Ansi-style
============================================================================
*/
#include <stdio.h>... |
C | /*
* STATUS IMPLEMENTATION FILE
* */
// Header files
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/wait.h>
#include "status.h"
/*
* INITIALIZE STATUS STRUCT
* */
void initStatus(struct Status * status)
{
status->value = 0;
status->normalTerm = 1;
}
/*
* CHANGE STATUS
* */
void chan... |
C | #include "holberton.h"
/**
*add - Adds two integers
*@a: number 1 to be added
*@b: number 2 to be added
*
*Description: Adds a and b and returns the sum
*Return: returns the sum of a and b
*/
int add(int a, int b)
{
return (a + b);
}
|
C | #include<stdio.h>
#include<math.h>
int main()
{
float w, h, BMI;
printf("enter w");
scanf("%f", &w);
printf("enter h");
scanf("%f", &h);
BMI = (w/(h*h));
printf("answer is %f", BMI);
return 0;
}
|
C | /* Generated with MicroDAQ toolbox ver: 1.2.0 */
#include "scicos_block4.h"
#include <stdio.h>
#include <stdlib.h>
#ifdef _TMS320C6X
#include "mdaq_uart.h"
#endif
#define RECV_TIMEOUT (100) // [us]
extern double get_scicos_time( void );
/* This function executed once at the beginning of model execution */
s... |
C | #include <stdlib.h>
#include <stdbool.h>
#include <stdio.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#define TRY_SEEK(RESULT) if ((RESULT) == -1) \
{ \
perror("failed to seek"); \
abort(); \
}
void help_communicate() {
print... |
C | #include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include "libnet.h"
/*
#define SECONDS_IN_DAY 86400
#define NTP_TO_UNIX = 2208988800 //((70 * 365 + 17) * 86400);
struct tm* __fastcall__ sntp_timestamp_to_tm(unsigned long sntp_timestamp) {
unsigned long epoch_timestamp=sntp_timestamp-NTP_TO_UNIX;
return (gmt... |
C |
/*-----------------------------------------------------------------------------
Program file: jrashelp1.c
Author: John Rashel
Date: February 4, 2018
Assignment: #1
Objective: This program shows the sum, difference, product, quotient with
the remainder of two integers. These integets are the month of
my... |
C | #include "elev.h"
#include <stdio.h>
#ifndef INCLUDE_IO
#include"io.h"
#define INCLUDE_IO
#endif
#ifndef INCLUDE_ORDERS
#include"orders.h"
#define INCLUDE_ORDERS
#endif
#ifndef INCLUDE_TIMER
#include"timer.h"
#define INCLUDE_TIMER
#endif
#include"elevator_FSM.h"
int main() {
// Initializ... |
C | #include "nat0.h"
Nat O(){
Nat ret = (Nat) malloc(sizeof(struct sn));
ret->f = '0';
ret->p = NULL;
return ret;
}
Nat s(Nat n){
Nat ret = (Nat) malloc(sizeof(struct sn));
ret->f = 's';
ret->p = n;
}
Nat add(Nat n, Nat m){
return n->f == '0' ? m : s(add(n->p, m));
}
Nat mult(Nat n, Nat m){
return n->f == '0'... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define DESC 0.10
#define DESCCART 0.15
#include <time.h>
///Digitar somente o que esta nas instrucoes, o programa nao esta calibrado para receber comandos diferentes do que se pede.
int main()
{
///Declaracao de variaveis
float preco[... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_keyhooks.c :+: :+: :+: ... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* dict.c :+: :+: :+: ... |
C | #include<string.h>
void main()
{
int y;
printf("enter the character");
y=getchar();
if(y>=65 && y<=90 || y>=97 && y<=122)
printf("\n Alphabet");
else if(y>=48 && y<=57)
printf("\n Digit");
else if(y==13 || y==32 || y==9 || y==10)
printf("\n Spcace");
else
printf("\n other option");
if(y>=65 && y<=90)
printf(... |
C | #include "libmy.h"
void my_swap_int(int *a, int *b)
{
int tmp;
tmp = *a;
*a = *b;
*b = tmp;
}
|
C | /*
* Rary - systemd example
*
* Build:
* gcc systemd_example.c ../src/systemd.c ../src/utils.c ../src/string.c
*/
#include "../src/rary.h"
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
int main(void) {
if (geteuid() != 0) {
fprintf(stderr, "Run as root!\n");
exit(1);
... |
C | #include <stdlib.h>
#include <stdio.h>
int main(int argc, char const *argv[])
{
return 0;
}
/**
*
* Tipos de estrucutas en los que haremos un repaso
* --Listas ligadas
* --Listas circulares (donde también hay un inico y un final)
* --Lista doblemente ligadas, donde cada lodo tiene también
* ... |
C |
#include <stdio.h>
#include <pigpio.h>
#define SENSOR 7
int main(int argc, char *argv[])
{
if (gpioInitialise() < 0)
{
fprintf(stderr, "pigpio initialisation failed\n");
return 1;
}
gpioSetMode(SENSOR, PI_INPUT);
printf("Keyence Sensor Test\n");
int currentState = 0, prevState = 0;
whi... |
C | #include "types.h"
#include "stat.h"
#include "user.h"
int main(int argc, char* argv[]){
if(argc != 2) {
printf(1, "Correct format: sleep <time>\n");
exit();
} else {
sleep(atoi(argv[1])*100);
exit();
}
} |
C | /* prog10-1.c: strings */
#include <stdio.h>
#include <string.h>
int main(void)
{
char s[20];
strcpy(s, "strings");
printf("s = %s\n", s);
printf("s[3] = %c\n", s[3]);
printf("s[6] = %c\n", s[6]);
printf("s[7] = %d\n", s[7]);
printf("strlen(s) = %lu\n",(unsigned long)strlen(s));
strcat(s, "... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.